extra-webextension
v0.4.0
Published
```sh npm install --save extra-webextension # or yarn add extra-webextension ```
Downloads
1,434
Readme
extra-webextension
Install
npm install --save extra-webextension
# or
yarn add extra-webextension
API
getActiveTab
function getActiveTab(): Promise<chrome.tabs.Tab>
LocalStorage
class LocalStorage<Storage extends Record<string, any>> {
getItem<Key extends keyof Storage>(key: Key): Promise<Storage[Key]>
setItem<Key extends keyof Storage>(key: Key, value: Storage[Key]): Promise<void>
removeItem<Key extends keyof Storage>(key: Key): Promise<void>
clear(): Promise<void>
}
SessionStorage
class SessionStorage<Storage extends Record<string, any>> {
getItem<Key extends keyof Storage>(key: Key): Promise<Storage[Key]>
setItem<Key extends keyof Storage>(key: Key, value: Storage[Key]): Promise<void>
removeItem<Key extends keyof Storage>(key: Key): Promise<void>
clear(): Promise<void>
}
waitForLaunch
enum LaunchReason {
Install
, Update
, Enable
, Activate
}
type LaunchDetails =
| { reason: LaunchReason.Install }
| {
reason: LaunchReason.Update
previousVersion: string
}
| { reason: LaunchReason.Enable }
| { reason: LaunchReason.Activate }
function waitForLaunch(): Promise<LaunchDetails>