Constructor
constructor(options?)
Parameters
options?: JetstreamOptions<WantedCollections>
Properties
Methods
onCreate(collection, listener)
Listen for records created in a specific collection.
Parameters
collection: T
The name of the collection to listen for.
listener: (event: CommitCreateEvent<T>) => void
A callback function that receives the commit event.
onUpdate(collection, listener)
Listen for records updated in a specific collection.
Parameters
collection: T
The name of the collection to listen for.
listener: (event: CommitEvent<T>) => void
A callback function that receives the commit event.
onDelete(collection, listener)
Listen for records deleted in a specific collection.
Parameters
collection: T
The name of the collection to listen for.
listener: (event: CommitEvent<T>) => void
A callback function that receives the commit event.
Overload 1/7
on(event, listener)
Emitted when the connection is opened.
Parameters
event: "open"
listener: () => void
Returns
this
on(event, listener)
Emitted when the connection is closed.
Parameters
event: "close"
listener: () => void
Returns
this
on(event, listener)
Emitted when a network error occurs.
Parameters
event: "error"
listener: (error: Error cursor?: number) => void
A callback function that receives the error and the last known cursor.
Returns
this
on(collection, listener)
Listen for all commits related to a specific collection.
Parameters
collection: T
The name of the collection.
listener: (event: CommitEvent<T>) => void
A callback function that receives the commit event.