Complete the code to request read permission at runtime.
const status = await Deno.permissions.[1]({ name: "read" });
The request method asks the user for permission at runtime.
Complete the code to check if write permission is already granted.
const status = await Deno.permissions.[1]({ name: "write" }); if (status.state === "granted") { console.log("Write permission granted."); }
The query method checks the current permission state without prompting the user.
Fix the error in the code to revoke net permission.
await Deno.permissions.[1]({ name: "net" });
The revoke method removes previously granted permission.
Fill both blanks to request permission and check if it was granted.
const status = await Deno.permissions.[1]({ name: "[2]" }); if (status.state === "granted") { console.log("Permission granted."); }
Use request to ask for permission and specify the permission name like read.
Fill all three blanks to check, request, and revoke run permission.
const status = await Deno.permissions.[1]({ name: "run" }); if (status.state !== "granted") { await Deno.permissions.[2]({ name: "run" }); } await Deno.permissions.[3]({ name: "run" });
First, query checks permission, then request asks for it, and finally revoke removes it.
