off

Removes listeners created with on().

Parameter

Description

lex

A lex query with the node id as "#".

callback

Optional. The callback to remove. Without it, every listener on the node is removed.

Without a callback, every listener on the node is removed, including ones watching other properties. Only the node id in the lex is used to find them.

Examples

// Keep a reference to the callback.
const changed = () => console.log("root changed")
holster.wire.on({"#": "root", ".": "key"}, changed)

// Later, remove just that listener.
holster.wire.off({"#": "root"}, changed)

// Remove every listener on the node.
holster.wire.off({"#": "root"})