summaryrefslogtreecommitdiff
path: root/cli/tests/workers/read_check_granular_worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/workers/read_check_granular_worker.js')
-rw-r--r--cli/tests/workers/read_check_granular_worker.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/workers/read_check_granular_worker.js b/cli/tests/workers/read_check_granular_worker.js
new file mode 100644
index 000000000..4eddb7a75
--- /dev/null
+++ b/cli/tests/workers/read_check_granular_worker.js
@@ -0,0 +1,13 @@
+import { fromFileUrl } from "../../../std/path/mod.ts";
+
+onmessage = async ({ data }) => {
+ const { state } = await Deno.permissions.query({
+ name: "read",
+ path: fromFileUrl(new URL(data.route, import.meta.url)),
+ });
+
+ postMessage({
+ hasPermission: state === "granted",
+ index: data.index,
+ });
+};