A Chromeapp contains the following: 1. The manifest file Manifest.json, which lists some basic information about the app, such as how to launch the app, permissions for the app, and more. 2. The event handling page is what we often call a background script (background script), which manages the entire activity cycle of the app, and this is where you handle some of the event's listening, such as how to start, close the app's form. 3. All code files must be packaged into a single chromeapp, containing Html,css,js and local templates 4. Other files, sample files also have to be packaged under Chromeapp to create an app the first step: Create a Manifest.json
{ "manifest_version": 2, "name": "Codelab", "version": "1", "icons": { "$": "Icon_128.png" }, "Permissions": [], "app": { "background": { "scripts": ["Background.js"] } }, "minimum_chrome_version": "28"}
It is important to note that the first line of "Manifest_version": 2 This must be added permissions how to access the site you need to add here background is the background script we have to deal with icons You need to provide a square picture (this will be shown in the Chromeapp's list of applications), and the size is the first parameter (px) 2. Add a picture that is icons, note that the size should be consistent with the previous, for example 128x128 3. Create Backgroud.js
/** * listens for the app launching then creates the window * * @see http://developer.chrome.com/apps/app.window.html */ch Rome.app.runtime.onLaunched.addListener (function () { chrome.app.window.create (' index.html ', { ID: ' Main ', bounds: {width:620, height:500} });
This function means to add a listener when the app starts, open index.html this site (next we'll create this) fourth step to create index.html
<! DOCTYPE html>
After completing the above steps, a Chromeapp related file is basically completed. The next step is to run. Run the program in the Chrome address bar to enter chrome://extensions/can open the extension list, tick "developer mode", click on "Load the expansion program in development" to open the Chromeapp package can see your app appears in the list. Click "Start" below the app to see the effect.How to create a Chromeapp