// this line make your web-extension compatible with Firefox, Chrome/Chromium and Opera
const nav = chrome?chrome:browser;
// you can now use the nav namespace object and use callback functions, for examle :
// nav.storage.local.remove(name);
// I use this peace of code in the FocusJUMP extension, Test it and say me what you think about :)
// https://sebastienaubry.pagesperso-orange.fr/focusjump/
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (1)
Even shorter, thanks to short-circuiting, is
const nav = chrome || browser;
which also allows for more legible chaining past two items - such as falling back to a polyfill or nullobject.Particularly useful if certain functions may require optional permissions.