Skip to content

Instantly share code, notes, and snippets.

@mdobson
Created February 12, 2014 20:37
Show Gist options
  • Save mdobson/8964024 to your computer and use it in GitHub Desktop.
Save mdobson/8964024 to your computer and use it in GitHub Desktop.
State Machines. All. The. Way. Down.
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