mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-04-03 14:39:37 +07:00
24 lines
621 B
JavaScript
24 lines
621 B
JavaScript
/**
|
|
* Listens for the app launching then creates the window
|
|
*
|
|
* @see http://developer.chrome.com/apps/app.runtime.html
|
|
* @see http://developer.chrome.com/apps/app.window.html
|
|
*/
|
|
chrome.app.runtime.onLaunched.addListener(function() {
|
|
// Center window on screen.
|
|
var screenWidth = screen.availWidth;
|
|
var screenHeight = screen.availHeight;
|
|
var width = 600;
|
|
var height = 400;
|
|
|
|
chrome.app.window.create('index.html', {
|
|
id: "window1",
|
|
outerBounds: {
|
|
width: width,
|
|
height: height,
|
|
left: Math.round((screenWidth-width)/2),
|
|
top: Math.round((screenHeight-height)/2)
|
|
}
|
|
});
|
|
});
|