mirror of
https://github.com/insin/control-panel-for-twitter.git
synced 2025-06-19 07:05:32 -04:00

- All page script settings are now stored in a single settings object - All other top-level config is for extension-internal settings - Renamed old settings which were marked with comments in types.d.ts Background script - Open welcome (new installs) or updated (v4 → v5) page post-install - Migrate v4 user settings to new v5 format on update Page script: - Removed userscript pragma - Renamed page script config variable to 'settings' Scripts: - Moved utility and script API functions to lib.js - Updated copy script to copy all *.mv*.* files in the root dir - Added a clean script and command to remove files which correspond to a *.mv*.* file
38 lines
944 B
JavaScript
38 lines
944 B
JavaScript
// Temporary until Firefox fixes its MV3 permissions problem (users are not
|
|
// prompted for required permissions on install, so extensions are installed in
|
|
// a disabled state).
|
|
export function get(keys) {
|
|
return new Promise((resolve, reject) => {
|
|
chrome.storage.local.get(keys, (result) => {
|
|
if (chrome.runtime.lastError) {
|
|
reject(chrome.runtime.lastError)
|
|
} else {
|
|
resolve(result)
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
export function remove(keys) {
|
|
return new Promise((resolve, reject) => {
|
|
chrome.storage.local.remove(keys, () => {
|
|
if (chrome.runtime.lastError) {
|
|
reject(chrome.runtime.lastError)
|
|
} else {
|
|
resolve()
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
export function set(keys) {
|
|
return new Promise((resolve, reject) => {
|
|
chrome.storage.local.set(keys, () => {
|
|
if (chrome.runtime.lastError) {
|
|
reject(chrome.runtime.lastError)
|
|
} else {
|
|
resolve()
|
|
}
|
|
})
|
|
})
|
|
} |