๐Ÿ†•off

This particular method enables you to cancel your subscription to an event that was initially set up using the nostr.on() function. This allows you to stop receiving notifications or triggers when a specific event occurs.

Method

function off(eventName: "accountChanged", listener: () => void): void;

Code Example

if (!nostr.on) { alert('not supported'); }

// subscribe to the accountChanged event
nostr.on("accountChanged", accountChangedHandler); // callback is executed once account is changed in provided with multiple accounts

// use .off() to unsubscribe from the event. 
nostr.off("accountChanged", accountChangedHandler);

function accountChangedHandler() {
    console.log("Account Changed!");
}

Last updated

Logo

Your bitcoin & nostr companion / from ๐Ÿ with ๐Ÿงก