EmailThis / extension-boilerplate

⚡️ A template for building cross browser extensions for Chrome, Opera & Firefox.
https://www.emailthis.me/open-source/extension-boilerplate
MIT License
3.28k stars 370 forks source link

ext.contextMenus is null. #22

Closed PetrosKalafatidis closed 6 years ago

PetrosKalafatidis commented 6 years ago

I have loaded the boilerplate on chrome and start watching it. npm run chrome-watch

When I am trying to use contextMenus I am getting a null error

background.js ext.runtime.onInstalled.addListener(() => { var id = ext.contextMenus.create({"title": "test menu", "contexts": ["selection"], "onclick": genericOnClick}); });

This gives me an error 'Cannot read property 'create' of null' I am tracing the ext object and I see a bunch of null values , alarms, bookmarks etc.

PetrosKalafatidis commented 6 years ago

I have tested with chrome.contextMenus and it's null again.

chrome.runtime.onInstalled.addListener(function() { // Replace all rules ... var id = chrome.contextMenus.create({"title": 'test menu', "contexts": ["selection"], "onclick": genericOnClick}); });