peterhil / spellbook

Spellbook is a WebExtension to easily add new bookmarks to correct categories
Mozilla Public License 2.0
29 stars 2 forks source link

Use webextension-polyfill #58

Closed peterhil closed 1 year ago

peterhil commented 3 years ago

Use webextension-polyfill

Try out WebExtensions polyfill by Mozilla or Web-Extension Polyfill for TypeScript if using Typescript already.

Highlights

Two way messaging

It's also possible to use Promises effectively using two-way messaging. Communication between a background page and a tab content script, for example, looks something like this from the background page side:

browser.tabs.sendMessage(tabId, "get-ids").then(results => {
  processResults(results);
});
peterhil commented 1 year ago

Replaced Rosegarden with webextension-polyfill, because Chrome’s new promisified APIs did not work with Rosegarden.