mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
28 lines
544 B
JavaScript
28 lines
544 B
JavaScript
|
onmessage = async () => {
|
||
|
const { state } = await Deno.permissions.query({
|
||
|
name: "read",
|
||
|
});
|
||
|
|
||
|
const worker = new Worker(
|
||
|
new URL("./read_check_worker.js", import.meta.url).href,
|
||
|
{
|
||
|
type: "module",
|
||
|
deno: {
|
||
|
namespace: true,
|
||
|
permissions: {
|
||
|
read: false,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
);
|
||
|
|
||
|
worker.onmessage = ({ data: childHasPermission }) => {
|
||
|
postMessage({
|
||
|
parentHasPermission: state === "granted",
|
||
|
childHasPermission,
|
||
|
});
|
||
|
close();
|
||
|
};
|
||
|
worker.postMessage(null);
|
||
|
};
|