snap_getBackgroundEvents
Description
Get the scheduled background events for the Snap.
Parameters
null
The request parameters for the snap_getBackgroundEvents method.
This method does not accept any parameters.
Returns
array
The result returned by the snap_getBackgroundEvents method.
It consists of an array background events (if any) for a snap.
object
Background event type.
Note: The date generated when scheduling an event with a duration will be represented in UTC.
id
stringThe unique id representing the event.
scheduledAt
stringThe ISO 8601 time stamp of when the event was scheduled.
snapId
SnapIdThe id of the snap that scheduled the event.
date
stringThe ISO 8601 date of when the event is scheduled for.
request
objectThe request that is supplied to the onCronjob handler
when the event is fired.
method
stringjsonrpc
"2.0" | nullid
number | string | nullparams
JsonRpcParamsExample
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' },
// },
// },
// ...,
// ]