Created
February 12, 2014 20:37
-
-
Save mdobson/8964024 to your computer and use it in GitHub Desktop.
State Machines. All. The. Way. Down.
This file contains hidden or 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
var HueDriver = module.exports = function() { | |
this.states [ | |
{ | |
state: 'on', | |
transitions: [ | |
{ 'turn-off': this.turnOff }, | |
{ | |
'set-color': this.setColor, | |
'inputs': [ | |
{ 'name':'RGB', 'type':'text'} | |
] | |
} | |
] | |
} | |
]; | |
this | |
.state('on', function(transition) { | |
transition | |
.on('set-color', this.setColor) | |
.field('RBG', 'text') | |
}) | |
} | |
HueApp.prototype.turnOff = function() { | |
this.driver.emit('turn-off', args); | |
}; | |
HueDriver.prototype.setColor = function(rgb, cb) { | |
cb(rgb); | |
}; | |
var Hue = require('../statemachine'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment