Fix example and globally namespace utility functions
This commit is contained in:
parent
2e74b8bdef
commit
bc9dd05cbc
|
@ -1,13 +1,13 @@
|
|||
var cylon = require("cylon");
|
||||
|
||||
var cylon = require('..');
|
||||
|
||||
// Initialize the robot
|
||||
var robot = cylon.robot({
|
||||
connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
|
||||
device: { name: 'led', driver: 'led', pin: 13 },
|
||||
|
||||
|
||||
work: function() {
|
||||
// we do our thing here
|
||||
every(1.second(), function() { console.log("ehlo"); });
|
||||
every((1).second(), function() { console.log("ehlo"); });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
'use strict';
|
||||
|
||||
Robot = require("./robot")
|
||||
utils = require('./utils')
|
||||
require('./utils')
|
||||
|
||||
exports.robot = (opts = {}) ->
|
||||
opts.master = this
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# Returns an interval
|
||||
# Examples:
|
||||
# every(10.seconds(), -> console.log("hello world (and again in 5 seconds)!"))
|
||||
exports.every = (interval, action) ->
|
||||
global.every = (interval, action) ->
|
||||
setInterval action, interval
|
||||
|
||||
# Public: Alias to setTimeout, combined with Number monkeypatches below to
|
||||
|
@ -27,7 +27,7 @@ exports.every = (interval, action) ->
|
|||
# Returns an interval
|
||||
# Examples:
|
||||
# after(10.seconds(), -> console.log("hello world from ten seconds ago!"))
|
||||
exports.after = (delay, action) ->
|
||||
global.after = (delay, action) ->
|
||||
setTimeout action, delay
|
||||
|
||||
Number::seconds = ->
|
||||
|
|
Loading…
Reference in New Issue