2020-03-09 10:18:02 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
2020-07-06 21:45:39 -04:00
|
|
|
import { sendSync } from "./dispatch_json.ts";
|
2020-07-13 12:23:24 -04:00
|
|
|
import type { PermissionState } from "../permissions.ts";
|
2020-03-09 10:18:02 -04:00
|
|
|
|
|
|
|
interface PermissionRequest {
|
|
|
|
name: string;
|
|
|
|
url?: string;
|
|
|
|
path?: string;
|
|
|
|
}
|
|
|
|
|
2020-07-06 21:45:39 -04:00
|
|
|
export function query(desc: PermissionRequest): PermissionState {
|
2020-03-09 10:18:02 -04:00
|
|
|
return sendSync("op_query_permission", desc).state;
|
|
|
|
}
|
|
|
|
|
2020-07-06 21:45:39 -04:00
|
|
|
export function revoke(desc: PermissionRequest): PermissionState {
|
2020-03-09 10:18:02 -04:00
|
|
|
return sendSync("op_revoke_permission", desc).state;
|
|
|
|
}
|
|
|
|
|
2020-07-06 21:45:39 -04:00
|
|
|
export function request(desc: PermissionRequest): PermissionState {
|
2020-03-09 10:18:02 -04:00
|
|
|
return sendSync("op_request_permission", desc).state;
|
|
|
|
}
|