diff options
Diffstat (limited to 'toolkit/components/extensions/types/globals.ts')
-rw-r--r-- | toolkit/components/extensions/types/globals.ts | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/toolkit/components/extensions/types/globals.ts b/toolkit/components/extensions/types/globals.ts index 45722828e2..dee9de0cf4 100644 --- a/toolkit/components/extensions/types/globals.ts +++ b/toolkit/components/extensions/types/globals.ts @@ -1,33 +1,32 @@ /** - * Support types for toolkit/components/extensions code. + * Gecko globals. */ +declare global { + const Cc: nsXPCComponents_Classes; + const Ci: nsIXPCComponents_Interfaces; + const Cr: nsIXPCComponents_Results; + const Components: nsIXPCComponents; -/// <reference lib="dom" /> -/// <reference path="./gecko.ts" /> -/// <reference path="./extensions.ts" /> + // Resolve typed generic overloads before the generated ones. + const Cu: nsXPCComponents_Utils & nsIXPCComponents_Utils; -// This now relies on types generated in bug 1872918, or get the built -// artifact tslib directly and put it in your src/node_modules/@types: -// https://phabricator.services.mozilla.com/D197620 -/// <reference types="lib.gecko.xpidl" /> + const Glean: GleanImpl; + const Services: JSServices; + const uneval: (any) => string; +} -// Exports for all other external modules redirected to globals.ts. -export var AppConstants, - GeckoViewConnection, GeckoViewWebExtension, IndexedDB, JSONFile, Log; +// Exports for all modules redirected here by a catch-all rule in tsconfig.json. +export var + AddonWrapper, AppConstants, GeckoViewConnection, GeckoViewWebExtension, + IndexedDB, JSONFile, Log, UrlbarUtils, WebExtensionDescriptorActor; /** - * This is a mock for the "class" from EventEmitter.sys.mjs. When we import - * it in extensions code using resource://gre/modules/EventEmitter.sys.mjs, - * the catch-all rule from tsconfig.json redirects it to this file. The export - * of the class below fulfills the import. The mock is needed when we subclass - * that EventEmitter, typescript gets confused because it's an old style - * function-and-prototype-based "class", and some types don't match up. - * + * A stub type for the "class" from EventEmitter.sys.mjs. * TODO: Convert EventEmitter.sys.mjs into a proper class. */ export declare class EventEmitter { + emit(event: string, ...args: any[]): void; on(event: string, listener: callback): void; once(event: string, listener: callback): Promise<any>; off(event: string, listener: callback): void; - emit(event: string, ...args: any[]): void; } |