Updated GhostCluster web sample from upstream
[profile/ivi/sdk/web-sample-build.git] / samples / web / Sample / Tizen / Web App / ModelloAMBSimulator / project / js / lightsDemo.js
1 /*global Simulator, async */
2
3 /**
4  * Script operates head lights, parking lights and child lock status using async.js library in following sequence:
5  *
6  * * wait for 2 seconds
7  * * turn on head lights and wait 1 second
8  * * turn on parking lights and wait 1 second
9  * * turn on child locks and wait 1 second
10  * * turn off head lights and wait 1 second
11  * * turn off parking lights and wait 1 second
12  * * turn off child locks and wait 1 second
13  *
14  * @module AMBSimulatorApplication
15  * @class LightsDemo
16  */
17
18 var properties = [ "LightHead", "LightParking", "ChildLockStatus" ];
19
20 async.series([ function(startTimeout) {
21         "use strict";
22         window.setTimeout(startTimeout, 2000);
23 }, function(turnOnCallback) {
24         "use strict";
25         async.eachSeries(properties, function(item, cb) {
26                 Simulator.set("vcan0", item, true, 0);
27                 window.setTimeout(cb, 1000);
28         }, turnOnCallback);
29 }, function(turnOffCallback) {
30         "use strict";
31         async.eachSeries(properties, function(item, cb) {
32                 Simulator.set("vcan0", item, false, 0);
33                 window.setTimeout(cb, 1000);
34         }, turnOffCallback);
35 } ]);