ampersand-state-mixin-datatype-function

1.0.0 • Public • Published

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'

Package Sidebar

Install

npm i ampersand-state-mixin-datatype-function

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • cdaringe