Actions for hudkit


An action is a wrapped, observable function that can be enabled/disabled. Actions are called just like normal functions but act as no-ops when disabled.

Note: this module was written for hudkit but can also be used in isolation.

$ npm install hudkit-action
var createAction = require('hudkit-action');

var myAction = createAction(function() {
    console.log("HELLO WORLD");

myAction(); // => "HELLO WORLD"
myAction(); // (nothing)

Create a new action with the given callback.

Option keys:

  • title: action title, default: ''
  • enabled: action enabled, default: true

Returns the action's title.

Set's the action title.

Returns true if action is enabled, false otherwise.

Toggle action enabled.

Disable action.

Enable action.

Set action enabled explicitly.

Signalkit signal that will be emitted when the action's state is changed.