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

Method removeAction

lib/thing.ts:497–512  ·  view source on GitHub ↗

* Remove an existing action. * * @param {String} actionName Name of the action * @param {String} actionId ID of the action * @returns boolean indicating the presence of the action.

(actionName: string, actionId: string)

Source from the content-addressed store, hash-verified

495 * @returns boolean indicating the presence of the action.
496 */
497 removeAction(actionName: string, actionId: string): boolean {
498 const action = this.getAction(actionName, actionId);
499 if (action === null) {
500 return false;
501 }
502
503 action.cancel();
504 for (let i = 0; i < this.actions[actionName].length; ++i) {
505 if (this.actions[actionName][i].getId() === actionId) {
506 this.actions[actionName].splice(i, 1);
507 break;
508 }
509 }
510
511 return true;
512 }
513
514 /**
515 * Add an available action.

Callers 1

deleteMethod · 0.80

Calls 3

getActionMethod · 0.95
cancelMethod · 0.80
getIdMethod · 0.45

Tested by

no test coverage detected