xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

chrome extensions & debug

debug background.js

debug popup.js

debug content_script.js

chrome.storage

chrome.storage.sync.get bug


// array OK
chrome.storage.sync.get([
    "jira_str",
    "jira_obj"
], function(items) {
    console.log(`chrome.storage.sync.get OK!`);
    console.log(`get items =`, JSON.stringify(items, null, 4));
});

// object Error
chrome.storage.sync.get({
    jira_str,
    jira_obj,
}, function(items) {
    console.log(`chrome.storage.sync.get OK!`);
    console.log(`get items =`, JSON.stringify(items, null, 4));
});

// chrome.storage.sync.get({
//     "jira_str",
//     "jira_obj",
// }, function(items) {
//     console.log(`chrome.storage.sync.get OK!`);
//     console.log(`get items =`, JSON.stringify(items, null, 4));
// });

API

https://developer.chrome.com/extensions/storage

https://developer.chrome.com/extensions/storage#using-sync

To store user data for your extension, you can use either storage.sync, or storage.local


// storage.sync
chrome.storage.sync.set({key: value}, function() {
    console.log('Value is set to ' + value);
});

chrome.storage.sync.get(['key'], function(result) {
    console.log('Value currently is ' + result.key);
});

// storage.local:

chrome.storage.local.set({key: value}, function() {
    console.log('Value is set to ' + value);
});

chrome.storage.local.get(['key'], function(result) {
    console.log('Value currently is ' + result.key);
});


https://stackoverflow.com/questions/14531102/saving-and-retrieving-from-chrome-storage-sync

https://stackoverflow.com/questions/22636771/chrome-storage-sync-vs-chrome-storage-local

https://bugs.chromium.org/p/chromium/issues/detail?id=161771

localStorage API

https://developer.mozilla.org/en/DOM/Storage#localStorage


zip

bash shell zip

# admin pwd
$ sudo apt install zip

$ zip -r chrome-jira.2018.12.18.zip chrome-jira/*

https://www.cnblogs.com/xgqfrms/p/9714161.html


official api docs

https://developer.chrome.com/extensions
https://developer.chrome.com/extensions/windows

https://developer.chrome.com/extensions/extension

https://developer.chrome.com/extensions/commands

https://developer.chrome.com/extensions/browserAction
https://developer.chrome.com/extensions/pageAction

https://developer.chrome.com/extensions/runtime
https://developer.chrome.com/extensions/runtime#property-lastError

https://developer.chrome.com/extensions/tabs

https://developer.chrome.com/extensions/system_storage
https://developer.chrome.com/extensions/system_memory
https://developer.chrome.com/extensions/system_cpu

https://developer.chrome.com/extensions/platformKeys

https://developer.chrome.com/extensions/omnibox


Flag Counter

©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


原文地址:https://www.cnblogs.com/xgqfrms/p/10135273.html