Skip to content

Instantly share code, notes, and snippets.

@mdobson
Created July 22, 2014 17:51
Show Gist options
  • Save mdobson/584a8d5c08e51105b1fd to your computer and use it in GitHub Desktop.
Save mdobson/584a8d5c08e51105b1fd to your computer and use it in GitHub Desktop.
new phone driver
var Phone = module.exports = function() {
this.x = 0;
this.y = 0;
this.z = 0;
};
Phone.prototype.init = function(config) {
config
.state('on')
.type('iphone')
.when('off', { allow: 'change' })
.when('on', { allow: 'change' })
.map('change', this.change,
[{ name: 'x', type: 'text' }, { name: 'y', type: 'text' }, { name: 'z', type: 'text' }])
.monitor('x')
.monitor('y')
.monitor('z');
};
Phone.prototype.change = function(x, y, z, cb) {
this.x = x;
this.y = y;
this.z = z;
if (cb) {
cb();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment