cylon/examples/robot_commands/robot_commands.coffee

20 lines
291 B
CoffeeScript
Raw Normal View History

2013-11-27 04:21:43 +08:00
Cylon = require '../..'
2013-11-26 06:28:13 +08:00
Cylon.api host: '0.0.0.0', port: '8080'
2013-11-27 04:21:43 +08:00
class MyRobot
commands: ["relax"]
2013-11-26 06:28:13 +08:00
relax: ->
2013-11-27 04:21:43 +08:00
"#{this.name} says relax"
2013-11-26 06:28:13 +08:00
work: (me) ->
every 1.seconds(), ->
console.log me.name
2013-11-26 06:28:13 +08:00
2013-11-27 04:21:43 +08:00
robot = new MyRobot
2013-11-26 06:28:13 +08:00
robot.name = "frankie"
Cylon.robot robot
Cylon.start()