1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00

docs(cli/dts): make worker example pass (#10703)

This commit is contained in:
Casper Beyer 2021-05-19 20:15:35 +08:00 committed by GitHub
parent 7f94db1bfd
commit 3af44a26eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1351,28 +1351,6 @@ declare interface WorkerOptions {
* },
* }
* );
* worker.postMessage({ cmd: "readFile", fileName: "./log.txt" });
*
* // deno_worker.ts
*
*
* self.onmessage = async function (e) {
* const { cmd, fileName } = e.data;
* if (cmd !== "readFile") {
* throw new Error("Invalid command");
* }
* const buf = await Deno.readFile(fileName);
* const fileContents = new TextDecoder().decode(buf);
* console.log(fileContents);
* }
*
* // $ cat log.txt
* // hello world
* // hello world 2
*
* // $ deno run --allow-read mod.ts
* // hello world
* // hello world2
* ```
*/
// TODO(Soremwar)