Reputation: 61
I'm trying to run an experimental Chrome extension (found here: https://github.com/GoogleChrome/chrome-app-samples/tree/master/serial/ledtoggle ) and can't seem to find the reason for this error in 'launch.js'. The app is setup the exact same way as other apps which run successfully, but this one in particular seems to refuse. The key files are below, and all the others are the same as you'll find in the repo. Experimental APIs & platform apps are enabled. Any help is appreciated, and I will mark the answer!
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)
Manifest.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"]
}
launch.js:
chrome.experimental.app.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
width: 400,
height: 400
});
});
Upvotes: 1
Views: 461
Reputation: 57651
There is no chrome.app.window
property, it is undefined. It seems that the idea is to open a new browser window, the correct code would be:
chrome.windows.create({
url: 'index.html',
width: 400,
height: 400
});
Edit: Apparently the chrome.app.window
API will be available in future Chrome versions (I can see it in Canary). It isn't there in Chrome 21 however.
Upvotes: 2