-
-
Save mdobson/584a8d5c08e51105b1fd to your computer and use it in GitHub Desktop.
new phone driver
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 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