mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Use definitely typed management types
This commit is contained in:
parent
eb979892ff
commit
4e50ab4866
2 changed files with 2 additions and 98 deletions
|
@ -16,11 +16,11 @@ export const KNOWN_EXTENSIONS: { [name: string]: string } = {
|
||||||
/** List of currently installed extensions.
|
/** List of currently installed extensions.
|
||||||
*/
|
*/
|
||||||
const installedExtensions: {
|
const installedExtensions: {
|
||||||
[id: string]: browser.management.IExtensionInfo
|
[id: string]: browser.management.ExtensionInfo
|
||||||
} = {}
|
} = {}
|
||||||
|
|
||||||
function updateExtensionInfo(
|
function updateExtensionInfo(
|
||||||
extension: browser.management.IExtensionInfo,
|
extension: browser.management.ExtensionInfo,
|
||||||
): void {
|
): void {
|
||||||
installedExtensions[extension.id] = extension
|
installedExtensions[extension.id] = extension
|
||||||
}
|
}
|
||||||
|
|
96
src/tridactyl.d.ts
vendored
96
src/tridactyl.d.ts
vendored
|
@ -89,102 +89,6 @@ interface WebExtEventBase<
|
||||||
|
|
||||||
hasListener(cb: TCallback): boolean
|
hasListener(cb: TCallback): boolean
|
||||||
}
|
}
|
||||||
type WebExtEvent<TCallback extends (...args: any[]) => any> = WebExtEventBase<
|
|
||||||
(callback: TCallback) => void,
|
|
||||||
TCallback
|
|
||||||
>
|
|
||||||
declare namespace browser.management {
|
|
||||||
/* management types */
|
|
||||||
|
|
||||||
/** Information about an icon belonging to an extension. */
|
|
||||||
interface IconInfo {
|
|
||||||
/**
|
|
||||||
* A number representing the width and height of the icon. Likely values include (but are not limited to) 128,
|
|
||||||
* 48, 24, and 16.
|
|
||||||
*/
|
|
||||||
size: number
|
|
||||||
/**
|
|
||||||
* The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is
|
|
||||||
* disabled, for example), append `?grayscale=true` to the URL.
|
|
||||||
*/
|
|
||||||
url: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A reason the item is disabled. */
|
|
||||||
type ExtensionDisabledReason = "unknown" | "permissions_increase"
|
|
||||||
|
|
||||||
/** The type of this extension. Will always be 'extension'. */
|
|
||||||
type ExtensionType = "extension" | "theme"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How the extension was installed. One of
|
|
||||||
* `development`: The extension was loaded unpacked in developer mode,
|
|
||||||
* `normal`: The extension was installed normally via an .xpi file,
|
|
||||||
* `sideload`: The extension was installed by other software on the machine,
|
|
||||||
* `other`: The extension was installed by other means.
|
|
||||||
*/
|
|
||||||
type ExtensionInstallType = "development" | "normal" | "sideload" | "other"
|
|
||||||
|
|
||||||
/** Information about an installed extension. */
|
|
||||||
interface IExtensionInfo {
|
|
||||||
/** The extension's unique identifier. */
|
|
||||||
id: string
|
|
||||||
/** The name of this extension. */
|
|
||||||
name: string
|
|
||||||
/** A short version of the name of this extension. */
|
|
||||||
shortName?: string
|
|
||||||
/** The description of this extension. */
|
|
||||||
description: string
|
|
||||||
/** The version of this extension. */
|
|
||||||
version: string
|
|
||||||
/** The version name of this extension if the manifest specified one. */
|
|
||||||
versionName?: string
|
|
||||||
/** Whether this extension can be disabled or uninstalled by the user. */
|
|
||||||
mayDisable: boolean
|
|
||||||
/** Whether it is currently enabled or disabled. */
|
|
||||||
enabled: boolean
|
|
||||||
/** A reason the item is disabled. */
|
|
||||||
disabledReason?: ExtensionDisabledReason
|
|
||||||
/** The type of this extension. Will always return 'extension'. */
|
|
||||||
type: ExtensionType
|
|
||||||
/** The URL of the homepage of this extension. */
|
|
||||||
homepageUrl?: string
|
|
||||||
/** The update URL of this extension. */
|
|
||||||
updateUrl?: string
|
|
||||||
/** The url for the item's options page, if it has one. */
|
|
||||||
optionsUrl: string
|
|
||||||
/**
|
|
||||||
* A list of icon information. Note that this just reflects what was declared in the manifest, and the actual
|
|
||||||
* image at that url may be larger or smaller than what was declared, so you might consider using explicit
|
|
||||||
* width and height attributes on img tags referencing these images. See the manifest documentation on icons
|
|
||||||
* for more details.
|
|
||||||
*/
|
|
||||||
icons?: IconInfo[]
|
|
||||||
/** Returns a list of API based permissions. */
|
|
||||||
permissions?: string[]
|
|
||||||
/** Returns a list of host based permissions. */
|
|
||||||
hostPermissions?: string[]
|
|
||||||
/** How the extension was installed. */
|
|
||||||
installType: ExtensionInstallType
|
|
||||||
}
|
|
||||||
|
|
||||||
/* management functions */
|
|
||||||
/** Returns a list of information about installed extensions. */
|
|
||||||
function getAll(): Promise<IExtensionInfo[] | undefined>
|
|
||||||
|
|
||||||
/* management events */
|
|
||||||
/** Fired when an addon has been disabled. */
|
|
||||||
const onDisabled: WebExtEvent<(info: IExtensionInfo) => void>
|
|
||||||
|
|
||||||
/** Fired when an addon has been enabled. */
|
|
||||||
const onEnabled: WebExtEvent<(info: IExtensionInfo) => void>
|
|
||||||
|
|
||||||
/** Fired when an addon has been installed. */
|
|
||||||
const onInstalled: WebExtEvent<(info: IExtensionInfo) => void>
|
|
||||||
|
|
||||||
/** Fired when an addon has been uninstalled. */
|
|
||||||
const onUninstalled: WebExtEvent<(info: IExtensionInfo) => void>
|
|
||||||
}
|
|
||||||
|
|
||||||
// html-tagged-template.js
|
// html-tagged-template.js
|
||||||
declare function html(
|
declare function html(
|
||||||
|
|
Loading…
Add table
Reference in a new issue