1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

docs(workers): fix permissions examples (#9965)

This commit is contained in:
Mason Medeiros 2021-04-06 10:06:17 -07:00 committed by GitHub
parent cbaa054154
commit c7fcba268f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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