我正在尝试运行一个实验性的 Chrome 扩展程序(在此处找到:https ://github.com/GoogleChrome/chrome-app-samples/tree/master/serial/ledtoggle )并且似乎找不到此错误的原因在“launch.js”中。该应用程序的设置方式与其他成功运行的应用程序完全相同,但这个应用程序似乎特别拒绝。关键文件如下,所有其他文件与您在 repo 中找到的相同。实验性 API 和平台应用程序已启用。任何帮助表示赞赏,我会标记答案!
Error in event handler for 'experimental.app.onLaunched': Cannot call method 'create' of undefined TypeError: Cannot call method 'create' of undefined
at chrome-extension://mkadehbifepfhnemaiighgighppmjgnp/launch.js:2:21
at chrome.Event.dispatch (event_bindings:237:41)
at chromeHidden.registerCustomHook.chrome.experimental.app.onLaunched.dispatch (experimental.app:32:39)
at Object.chromeHidden.Event.dispatchJSON (event_bindings:151:55)
清单.json:
{
"name": "Serial Test",
"version": "1",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["launch.js"]
}
},
"icons": {
"16": "icon_16.png",
"128": "icon_128.png"
},
"permissions": ["experimental"]
}
启动.js:
chrome.experimental.app.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
width: 400,
height: 400
});
});