Skip to main content
  • Snap

snap_getBackgroundEvents

Description

Get the scheduled background events for the Snap.

Returns

{ id: string; scheduledAt: string; snapId: SnapId; date: string; request: { method: string; jsonrpc?: "2.0" | null; id?: number | string | null; params?: Json[] | Record<string, Json> | null } }[]

The result returned by the snap_getBackgroundEvents method.

It consists of an array background events (if any) for a snap.

Example

const events = await snap.request({
method: "snap_getBackgroundEvents",
});
console.log(events);
// [
// {
// id: 'event-1',
// scheduledAt: 1672531200000,
// snapId: 'npm:example-snap',
// date: 1672531200000,
// request: {
// method: 'example_method',
// params: { example: 'data' },
// },
// },
// ...,
// ]