MCPcopy Create free account
hub / github.com/jakesgordon/javascript-state-machine / build

Function build

lib/state-machine.js:615–631  ·  view source on GitHub ↗
(target, config)

Source from the content-addressed store, hash-verified

613}
614
615function build(target, config) {
616 if ((typeof target !== 'object') || Array.isArray(target))
617 throw Error('StateMachine can only be applied to objects');
618 plugin.build(target, config);
619 Object.defineProperties(target, PublicProperties);
620 mixin(target, PublicMethods);
621 mixin(target, config.methods);
622 config.allTransitions().forEach(function(transition) {
623 target[camelize(transition)] = function() {
624 return this._fsm.fire(transition, [].slice.call(arguments))
625 }
626 });
627 target._fsm = function() {
628 this._fsm = new JSM(this, config);
629 this._fsm.init(arguments);
630 }
631}
632
633//-----------------------------------------------------------------------------------------------
634

Callers 2

factoryFunction · 0.70
applyFunction · 0.70

Calls 1

camelizeFunction · 0.70

Tested by

no test coverage detected