Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #61 from qwtel/scheduledevent
Browse files Browse the repository at this point in the history
Add ScheduledEvent
  • Loading branch information
1000hz committed Oct 4, 2020
2 parents 69168ea + 4654c23 commit 21fcf9b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ interface FetchEvent {
passThroughOnException: () => void;
}

interface ScheduledEvent {
/**
* The type of event. This will always return `"scheduled"`.
*/
type: string;
/**
* The time the `ScheduledEvent` was scheduled to be executed in
* milliseconds since January 1, 1970, UTC.
* It can be parsed as `new Date(event.scheduledTime)`
*/
scheduledTime: number;
/**
* Use this method to notify the runtime to wait for asynchronous tasks
* (e.g. logging, analytics to third-party services, streaming and caching).
* The first `event.waitUntil` to fail will be observed and recorded as the
* status in the Cron Trigger Past Events table. Otherwise, it will be
* reported as a Success.
*/
waitUntil(promise: Promise<any>): void;
}

interface BasicImageTransformations {
/**
* Maximum width in image pixels. The value must be an integer.
Expand Down Expand Up @@ -286,6 +307,7 @@ interface RequestInit {
}

declare function addEventListener(type: 'fetch', handler: (event: FetchEvent) => void): void;
declare function addEventListener(type: 'scheduled', handler: (event: ScheduledEvent) => void): void;

interface Request {
cf: IncomingRequestCfProperties;
Expand Down

0 comments on commit 21fcf9b

Please sign in to comment.