react/packages/react-devtools-shared/src/devtools/views/context.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-08-28 01:54:01 +08:00
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
2019-01-23 03:04:37 +08:00
2019-08-14 08:58:03 +08:00
import {createContext} from 'react';
2019-01-23 03:04:37 +08:00
import Store from '../store';
import type {ViewAttributeSource} from 'react-devtools-shared/src/devtools/views/DevTools';
2019-08-14 08:58:03 +08:00
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
export const BridgeContext = createContext<FrontendBridge>(
2019-08-14 08:58:03 +08:00
((null: any): FrontendBridge),
);
BridgeContext.displayName = 'BridgeContext';
2019-01-24 00:45:19 +08:00
export const StoreContext = createContext<Store>(((null: any): Store));
2019-02-02 01:25:54 +08:00
StoreContext.displayName = 'StoreContext';
export type ContextMenuContextType = {|
isEnabledForInspectedElement: boolean,
viewAttributeSourceFunction?: ?ViewAttributeSource,
|};
export const ContextMenuContext = createContext<ContextMenuContextType>({
isEnabledForInspectedElement: false,
viewAttributeSourceFunction: null,
});
ContextMenuContext.displayName = 'ContextMenuContext';