Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would you consider adding more shims? #1

Open
2 of 5 tasks
abalter opened this issue Nov 6, 2022 · 1 comment
Open
2 of 5 tasks

Would you consider adding more shims? #1

abalter opened this issue Nov 6, 2022 · 1 comment

Comments

@abalter
Copy link

abalter commented Nov 6, 2022

This is sort of a feature request, but moreso, a shameless request for help with MY project.

I'm trying to port a chrome app to be a web app. I found this shim and it's doing a lot of the work. There are still some chrome API methods that need to be covered. I'm not a javascript or web programmer, but I'm kind of trying to build a proof-of-concept thing.

In particular, this is the list of chrome methods used in my app vs. ones already in the shim.

Chrome Methods Needed for My App

  • chrome.notifications
  • chrome.storage
  • chrome.fileSystem
  • chrome.runtime
  • chrome.app

Right now (in this branch) the error I get is

jQuery.Deferred exception: chrome.storage.sync is undefined IdeSettingsHandler/this.init@http://localhost/codepad-chrome-app/src/js/handlers/ide.settings.js:70:9

https://github.com/abalter/codepad-webapp/blob/chrome-storage-sync-problem/src/js/handlers/ide.settings.js#L70

@coder0107git
Copy link

coder0107git commented Dec 3, 2022

@abalter The chrome.storage.sync is undefined error can be solved by adding

sync: {
    set: function(...params) { 
        browser.storage.local.set(...params);
    },
    get: function(...params) {
        return browser.storage.local.get(...params); 
    },
},

after Line 87 in your WebExtensionShim.js file. Note: The code only works on these browsers without transpilation. If you need more browsers to be supported use a transpiler like Babel.js.
I made an example JSFiddle here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants