File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
src/content/docs/workers/configuration Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,36 @@ Cron Triggers execute on UTC time.
2727
2828To respond to a Cron Trigger, you must add a [ ` "scheduled" ` handler] ( /workers/runtime-apis/handlers/scheduled/ ) to your Worker.
2929
30- Refer to the following examples to write your code:
30+ import { TabItem , Tabs } from " ~/components" ;
31+
32+ <Tabs syncKey = " workersExamples" > <TabItem label = " JavaScript" icon = " seti:javascript" >
33+
34+ ``` js
35+ export default {
36+ async scheduled (event , env , ctx ) {
37+ console .log (" cron processed" );
38+ },
39+ };
40+ ```
41+
42+ </TabItem > <TabItem label = " TypeScript" icon = " seti:typescript" >
43+
44+ ``` ts
45+ interface Env {}
46+ export default {
47+ async scheduled(
48+ controller : ScheduledController ,
49+ env : Env ,
50+ ctx : ExecutionContext ,
51+ ) {
52+ console .log (" cron processed" );
53+ },
54+ };
55+ ```
56+
57+ </TabItem > </Tabs >
58+
59+ Refer to the following additional examples to write your code:
3160
3261- [ Setting Cron Triggers] ( /workers/examples/cron-trigger/ )
3362- [ Multiple Cron Triggers] ( /workers/examples/multiple-cron-triggers/ )
You can’t perform that action at this time.
0 commit comments