Skip to content

Instantly share code, notes, and snippets.

@dpjanes
Created August 10, 2015 21:33
Show Gist options
  • Save dpjanes/b9cd54d63284325c2d41 to your computer and use it in GitHub Desktop.
Save dpjanes/b9cd54d63284325c2d41 to your computer and use it in GitHub Desktop.
Cookbook / Recipe Example
/*
* 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