File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
src/content/partials/workers Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ main = "./src/workerB.js"
1717
1818<TypeScriptExample >
1919
20- ``` js
20+ ``` ts
2121import { WorkerEntrypoint } from " cloudflare:workers" ;
2222
2323export default class extends WorkerEntrypoint {
@@ -49,11 +49,15 @@ services = [
4949
5050Making it possible for Worker A to call the ` add() ` method from Worker B:
5151
52- ``` js
52+ <TypeScriptExample >
53+
54+ ``` ts
5355export default {
5456 async fetch(request , env ) {
5557 const result = await env .WORKER_B .add (1 , 2 );
5658 return new Response (result );
5759 },
5860};
5961```
62+
63+ </TypeScriptExample >
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ main = "./src/counterService.js"
1717
1818<TypeScriptExample >
1919
20- ``` js
20+ ``` ts
2121import { WorkerEntrypoint } from " cloudflare:workers" ;
2222
2323export default class extends WorkerEntrypoint {
@@ -35,6 +35,8 @@ export default class extends WorkerEntrypoint {
3535}
3636```
3737
38+ </TypeScriptExample >
39+
3840This function can then be called by the client Worker:
3941
4042<WranglerConfig >
@@ -49,6 +51,8 @@ services = [
4951
5052</WranglerConfig >
5153
54+ <TypeScriptExample >
55+
5256``` ts
5357export default {
5458 async fetch(request : Request , env : Env ) {
You can’t perform that action at this time.
0 commit comments