Created
August 10, 2015 21:33
-
-
Save dpjanes/b9cd54d63284325c2d41 to your computer and use it in GitHub Desktop.
Cookbook / Recipe Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* repeat-3.js | |
* | |
* David Janes | |
* IOTDB.org | |
* 2014-12-30 | |
* | |
* This will broadcast Count=0, Count=1, Count=3 | |
* when pushed. | |
*/ | |
var iotdb = require('iotdb'); | |
iotdb.cookbook("Demo"); | |
iotdb.recipe({ | |
enabled: true, | |
name: "Repeat 3", | |
onclick: function(context) { | |
context.message(""); | |
var count = 0; | |
var id = setInterval(function() { | |
context.message("Count=" + count); | |
if (count++ >= 3) { | |
clearInterval(id); | |
context.done(); | |
} | |
}, 3000); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment