take-action
Action.create(action)
Creates an action with the given definition. Returns a function that accepts jacks
and props
as arguments, respectively. This function will validate the jacks using jackTypes
and the props using propTypes
before performing the action. Additionally, defaults can be supplied by providing getDefaultJacks
and getDefaultProps
functions.
var Action = ;var createUser = Action;// a jack is an interface for external objects// a plug is an implementation of a jackvar jacks =users:;var props =email: 'john@doe.com';;
Action.bindActionsToJacks(actions, jacks)
Returns a new set of actions, each bound to jacks
, accepting props
as the only argument.
var Action = ;var actions ={jackslang;}{jackslang;};var jacks =lang:{console;}{console;};var Greetings = Action;var user =name: 'John';Greetings; // Hello, JohnGreetings; // Goodbye, John