1.文件结构
内容如下:
manifest.json
{
"name": "Hello World!",
"description": "My first Chrome App.",
"version": "0.1",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": { "16": "calculator-16.png", "128": "calculator-128.png" }
}
background.js
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('window.html', {
'outerBounds': {
'width': 400,
'height': 500
}
});
});
window.html
<!DOCTYPE html>
<html>
<head></head>
<body>Hello World!</body>
</html>
manifest.json 是入口文件,引出了background.js, background.js引出了window.html
2.配置启动
或者使用命令行:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --load-and-launch-app=F:\live-dev\chrome-app\
或
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app-id=bbcfgdgmbdldogmldhdnehahjencpgbi
3.API参看
https://developer.chrome.com/apps/api_index
4.如何调试background.js
打开 chrome://extensions/
做完这三步之后 在console就能看到