1.0.0 • Published 9 years ago
ampersand-state-mixin-datatype-function v1.0.0
ampersand-state-mixin-datatype-function
Adds the function datatype to ampersand-state
You may want to specify something like the following in your ampersand-states or ampersand-models:
var State = require('ampersand-state');
var MyState = State.extend({
props: {
beep: {
type: 'function',
required: true
}
}
});
usage
Using the example from above
var State = require('ampersand-state');
var funcMixin = require('ampersand-state-mixin-datatype-function');
var StateF = State.extend(funcMixin, {
props: {
beep: {
type: 'function',
required: true
}
}
});
var robot = new StateF({
beep: function() {
console.log('bop');
}
});
robot.beep(); //=> 'bop'
1.0.0
9 years ago