File
Blob: src/workerd/api/tests/stw-jsrpc-dataclone-receiver.js
| 1 | // Copyright (c) 2026 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | import { WorkerEntrypoint } from 'cloudflare:workers'; |
| 5 | |
| 6 | const results = []; |
| 7 | |
| 8 | export class Receiver extends WorkerEntrypoint { |
| 9 | async capture(record) { |
| 10 | results.push(record); |
| 11 | return { ok: true }; |
| 12 | } |
| 13 | |
| 14 | async reset() { |
| 15 | results.length = 0; |
| 16 | } |
| 17 | |
| 18 | async getResults() { |
| 19 | return results.slice(); |
| 20 | } |
| 21 | } |