Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/polkadot/api/base/Events.ts>Events#once

Package publishing for deno.land/x/polkadot
Go to Latest
method Events.prototype.once
import { Events } from "https://deno.land/x/polkadot@0.2.29/api/base/Events.ts";

Examples

api.once('connected', (): void => {
  console.log('API has been connected to the endpoint');
});

api.once('disconnected', (): void => {
  console.log('API has been disconnected from the endpoint');
});

Parameters

The type of event to listen to. Available events are connected, disconnected, ready and error

handler: (...args: any[]) => any

The callback to be called when the event fires. Depending on the event type, it could fire with additional arguments.