Comments (7)
There indeed is not a tutorial for this extension. It's not that big of an extension and a tutorial would have to be very comprehensive
When it comes to storing data you will probably want to look at the crmAPI.storage API. With it you can permanently store data for a specific script. If you want to store it for just that website, you can use the localStorage API as well.
from customrightclickmenu.
I try to use basic script like this:
var value = "test";
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);
});
the console shows:
Value is set to test
Value currently is [object] (empty data)
why "chrome.storage.local.get" doesnt work?
I tick all the permission in "edit script", it got untick itself all the time.
from customrightclickmenu.
That's right, you can't use the chrome.storage
APIs or any other chrome APIs. That is a security measure to prevent scripts from breaking/changing extension data (you would be writing your data to the same place the extension stores its data). That's why you should use the crmAPI.storage API instead. You can also use the crmAPI.browser API which is supposed to mimic the call signature of those chrome functions.
from customrightclickmenu.
when i'm doing this:
crmAPI.browser.storage.local.set({key: value}, function() {
console.log('Value is set to ' + value);
});
crmAPI.browser.storage.local.get(['key'], function(result) {
console.log('Value currently is ' + result.key);
});
it shows "crmapi.js:5 Looks like you didn't send your chrome function, set crmAPI.warnOnChromeFunctionNotSent to false to disable this message"
do i miss something?
from customrightclickmenu.
You have to call .send()
at the end. So instead of
crmAPI.browser.storage.local.set({key: value}, function() {
console.log('Value is set to ' + value);
});
do
crmAPI.browser.storage.local.set({key: value}, function() {
console.log('Value is set to ' + value);
}).send();
There are some examples in the documentation i sent although the formatting has gone a bit bad.
Also you might want to call .get()
in the callback of .set()
, because otherwise the setting operations hasn't completed by the time you're calling .get()
from customrightclickmenu.
it shows "Error: Permission storage is not allowed for scripts, please use a CRM API"
I end up using CRM API storage. It works. I think this extension is really really powerful.
Maybe you should add more advanced example code in the tutorial. Currently your tutorial only show very basic code which is too bad because it can do many powerful things.
Btw thank you so much for making this extension. I will continue to learn by mistake. :)
from customrightclickmenu.
Good to hear that you got it working, I didn't know that the browser API didn't work.
I probably should add some more example code but I'm currently a bit busy. I'll try to get to it some time soon.
from customrightclickmenu.
Related Issues (20)
- Execute when visiting specified sites HOT 1
- [wiki] please give an example how to pass link as an argument for search engine HOT 3
- [wiki]How to add Copy Tab URL HOT 8
- [Questions] Window title! + couple extras HOT 8
- CRX_SIGNATURE_VERIFICATION_FAILED - Cant add extension to edge HOT 3
- [wiki] Download Tutorial HOT 26
- An error occurred. The package is invalid:“CRX_SIGNATURE_VERIFICATION_FAILED” HOT 1
- Can't run the script on chrome-extension:// page. HOT 1
- Is it possible to add items straight to the context menu and not into the submenu? HOT 3
- Cannot rename main node (Custom Menu) to something else in EDGE (works in Google) HOT 3
- Manage permissions dialog is not working HOT 2
- Project abandoned or in development HOT 7
- Bug: Cannot view or edit submenu HOT 1
- Is it possible the use the current tab url in the link settings? HOT 2
- add text to the context menu that when you click on the text it adds it to the form text box HOT 5
- Get text from the CRM item clicked HOT 18
- True copy and paste operation vs determining which field I right clicked in HOT 5
- addon hijacks .js file links HOT 11
- image right click HOT 2
- How to use CRM Keyboard Shortcut in extension shortcuts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from customrightclickmenu.