diff options
author | Mason Medeiros <medeiros.mck@gmail.com> | 2021-04-06 10:06:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 19:06:17 +0200 |
commit | c7fcba268f665622086d916f464212972837dc29 (patch) | |
tree | d67d82571fff4c391cf58bc9f7cc43640bd00756 /docs/runtime | |
parent | cbaa054154e85dc72ac9726fb6ea9dab6ede8021 (diff) |
docs(workers): fix permissions examples (#9965)
Diffstat (limited to 'docs/runtime')
-rw-r--r-- | docs/runtime/workers.md | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/docs/runtime/workers.md b/docs/runtime/workers.md index d1a47e6d9..d39a8b130 100644 --- a/docs/runtime/workers.md +++ b/docs/runtime/workers.md @@ -143,7 +143,7 @@ the `deno.permissions` option in the worker API. type: "module", deno: { namespace: true, - permissions: [ + permissions: { net: [ "https://deno.land/", ], @@ -152,7 +152,7 @@ the `deno.permissions` option in the worker API. new URL("./file_2.txt", import.meta.url), ], write: false, - ], + }, }, }); ``` @@ -163,18 +163,21 @@ the `deno.permissions` option in the worker API. file is currently in ```ts - const worker = new Worker(new URL("./worker/worker.js", import.meta.url).href, { - type: "module", - deno: { - namespace: true, - permissions: [ - read: [ - "/home/user/Documents/deno/worker/file_1.txt", - "./worker/file_2.txt", - ], - ], + const worker = new Worker( + new URL("./worker/worker.js", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: { + read: [ + "/home/user/Documents/deno/worker/file_1.txt", + "./worker/file_2.txt", + ], + }, + }, }, - }); + ); ``` - Both `deno.permissions` and its children support the option `"inherit"`, which @@ -233,8 +236,8 @@ the `deno.permissions` option in the worker API. }); ``` -- You can disable the permissions of the worker all together by passing false to - the `deno.permissions` option. +- You can disable the permissions of the worker all together by passing `"none"` + to the `deno.permissions` option. ```ts // This worker will not have any permissions enabled |