withPermissionsCheck.js — react Source File
Architecture documentation for withPermissionsCheck.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a201d0c0_1857_9450_a232_8ba0c7c32678["withPermissionsCheck.js"] 44d1f6cd_f315_e304_a0b5_d6195ef5dcd9["PermissionNotGrantedError"] a201d0c0_1857_9450_a232_8ba0c7c32678 --> 44d1f6cd_f315_e304_a0b5_d6195ef5dcd9 style a201d0c0_1857_9450_a232_8ba0c7c32678 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {PermissionNotGrantedError} from 'react-devtools-shared/src/errors/PermissionNotGrantedError';
type SupportedPermission = 'clipboardWrite';
type Permissions = Array<SupportedPermission>;
type PermissionsOptions = {permissions: Permissions};
// browser.permissions is not available for DevTools pages in Firefox
// https://bugzilla.mozilla.org/show_bug.cgi?id=1796933
// We are going to assume that requested permissions are not optional.
export function withPermissionsCheck<T: (...$ReadOnlyArray<empty>) => mixed>(
options: PermissionsOptions,
callback: T,
): T | (() => Promise<ReturnType<T>>) {
if (!__IS_CHROME__ && !__IS_EDGE__) {
return callback;
} else {
return async () => {
const granted = await chrome.permissions.request(options);
if (granted) {
return callback();
}
return Promise.reject(new PermissionNotGrantedError());
};
}
}
Dependencies
- PermissionNotGrantedError
Source
Frequently Asked Questions
What does withPermissionsCheck.js do?
withPermissionsCheck.js is a source file in the react codebase, written in javascript.
What does withPermissionsCheck.js depend on?
withPermissionsCheck.js imports 1 module(s): PermissionNotGrantedError.
Where is withPermissionsCheck.js in the architecture?
withPermissionsCheck.js is located at packages/react-devtools-shared/src/frontend/utils/withPermissionsCheck.js (directory: packages/react-devtools-shared/src/frontend/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free