MCPcopy Create free account
hub / github.com/WebThingsIO/webthing-node / addAvailableAction

Method addAvailableAction

lib/thing.ts:522–534  ·  view source on GitHub ↗

* Add an available action. * * @param {String} name Name of the action * @param {Object} metadata Action metadata, i.e. type, description, etc., as * an object. * @param {Object} cls Class to instantiate for this action

(name: string,
                     metadata: Action.ActionMetadata|null,
                     cls: Action.ActionTypeClass)

Source from the content-addressed store, hash-verified

520 * @param {Object} cls Class to instantiate for this action
521 */
522 addAvailableAction(name: string,
523 metadata: Action.ActionMetadata|null,
524 cls: Action.ActionTypeClass): void {
525 if (!metadata) {
526 metadata = {};
527 }
528
529 this.availableActions[name] = {
530 metadata: metadata,
531 class: cls,
532 };
533 this.actions[name] = [];
534 }
535
536 /**
537 * Add a new websocket subscriber.

Callers 2

makeThingFunction · 0.95
constructorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected