Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/live/deps.ts>supabase.RealtimeChannel#on

Open-Source web editor based on Preact, Tailwind and TypeScript. The other side of code.
Go to Latest
method supabase.RealtimeChannel.prototype.on
Re-export
import { supabase } from "https://deno.land/x/live@1.53.6/deps.ts";
const { RealtimeChannel } = supabase;

Creates an event handler that listens to changes.

Parameters

type: `${REALTIME_LISTEN_TYPES.PRESENCE}`
filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.SYNC}`; }
callback: () => void

Type Parameters

T extends { [key: string]: any; }

Parameters

type: `${REALTIME_LISTEN_TYPES.PRESENCE}`
filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.JOIN}`; }
callback: (payload: RealtimePresenceJoinPayload<T>) => void

Type Parameters

T extends { [key: string]: any; }

Parameters

type: `${REALTIME_LISTEN_TYPES.PRESENCE}`
filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.LEAVE}`; }
callback: (payload: RealtimePresenceLeavePayload<T>) => void

Type Parameters

T extends { [key: string]: any; }

Parameters

type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`
filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.ALL}`>
callback: (payload: RealtimePostgresChangesPayload<T>) => void

Type Parameters

T extends { [key: string]: any; }

Parameters

type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`
filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT}`>
callback: (payload: RealtimePostgresInsertPayload<T>) => void

Type Parameters

T extends { [key: string]: any; }

Parameters

type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`
filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE}`>
callback: (payload: RealtimePostgresUpdatePayload<T>) => void

Type Parameters

T extends { [key: string]: any; }

Parameters

type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`
filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE}`>
callback: (payload: RealtimePostgresDeletePayload<T>) => void

The following is placed here to display on supabase.com/docs/reference/javascript/subscribe.

Parameters

type: `${REALTIME_LISTEN_TYPES.BROADCAST}`

One of "broadcast", "presence", or "postgres_changes".

filter: { event: string; }

Custom object specific to the Realtime feature detailing which payloads to receive.

callback: (payload: { [key: string]: any; type: `${REALTIME_LISTEN_TYPES.BROADCAST}`; event: string; }) => void

Function to be invoked when event handler is triggered.

Type Parameters

T extends { [key: string]: any; }

Parameters

type: `${REALTIME_LISTEN_TYPES.BROADCAST}`
filter: { event: string; }
callback: (payload: { type: `${REALTIME_LISTEN_TYPES.BROADCAST}`; event: string; payload: T; }) => void