develop chrome plug-ins, chrome.desktopCapture does not exist, the plug-ins I downloaded in the chrome store can be used normally, but I write a plug-in myself, API on chrome is undefined, can not be used.
background.js
var app = {};
app.tz = function (msg) {
var id = "my-notification";
var options = {
"title": "",
"type": "basic",
"message": msg,
"iconUrl": chrome.runtime.getURL("img/icon.png")
};
chrome.notifications.create(id, options, function (e) { });
};
app.start = function(){
if (chrome.desktopCapture) {
app.tz("")
} else {
app.tz("")
}
}
popup.js
var bg = chrome.extension.getBackgroundPage();
var start = document.getElementById("start");
start.onclick = function(){
bg.app.start();
}
execution effect
API
excuse me, do I still have those things that I haven"t configured?
my manifest.json
{
"manifest_version": 2,
"name": "demo",
"version": "1.0.0",
"description": "Chromedemo",
"icons": {
"16": "img/icon.png",
"48": "img/icon.png",
"128": "img/icon.png"
},
"browser_action": {
"default_icon": "img/icon.png",
"default_title": "Chrome",
"default_popup": "popup.html"
},
"background": {
"page": "background.html"
},
"permissions": [
"contextMenus",
"tabs",
"notifications",
"webRequest",
"webRequestBlocking",
"storage",
"http://*/*",
"https://*/*"
]
}