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

chrome extensions & debug

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



©xgqfrms 2012-2020

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


posted @   xgqfrms  阅读(461)  评论(5编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示