EasyManuals Logo

Arduino Pro Mini User Manual

Arduino Pro Mini
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #282 background imageLoading...
Page #282 background image
native applications lifecycle, the Chrome environment controls a web appli-
cations lifecycle. It provides the web applications with important events, such
as alarms or signals.
The
background.js
file is where you connect your Chrome app to the Chrome
runtime environment. You can register for many events, but you at least have
to specify what happens when your application gets launched. Heres how
you can do that:
ChromeApps/SimpleApp/background.js
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('main.html', {
id: 'main',
bounds: { width: 200, height: 100 }
});
});
The preceding file adds a new listener function to Chromes runtime environ-
ment. Specifically, it registers a listener function for the
onLaunched
eventthat
is, the function will be called when the Chrome app gets launched.
The listener opens a new Chrome app window by calling the
chrome.app.win-
dow.create
function. This function expects the name of an HTML document to
be opened and some optional arguments, such as the windows ID and its
bounds. For our first Chrome app, the HTML document looks as follows:
ChromeApps/SimpleApp/main.html
<!DOCTYPE html>
<html>
<head>
<title>My First Chrome App</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
These three files (
manifest.json
,
background.js
, and
main.html
) are all you need for a
basic Chrome app. In the next section, youll learn how to run the application
for the first time.
Starting the Chrome App
During development, itd be tedious to create zip archives every time you
wanted to try your latest changes to a Chrome app. Thats why the Chrome
browser supports the execution of unzipped applications. Point the browser
Appendix 4. Controlling the Arduino with a Browser 270
report erratum discuss
www.it-ebooks.info

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino Pro Mini and is the answer not in the manual?

Arduino Pro Mini Specifications

General IconGeneral
BrandArduino
ModelPro Mini
CategoryMotherboard
LanguageEnglish

Related product manuals