"Fossies" - the Fresh Open Source Software Archive

Member "graylog2-server-4.0.6/graylog2-web-interface/src/views/logic/ActionContext.jsx" (7 Apr 2021, 1250 Bytes) of package /linux/misc/graylog2-server-4.0.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) JSX source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "ActionContext.jsx": 3.3.8_vs_4.0.0.

    1 /*
    2  * Copyright (C) 2020 Graylog, Inc.
    3  *
    4  * This program is free software: you can redistribute it and/or modify
    5  * it under the terms of the Server Side Public License, version 1,
    6  * as published by MongoDB, Inc.
    7  *
    8  * This program is distributed in the hope that it will be useful,
    9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   11  * Server Side Public License for more details.
   12  *
   13  * You should have received a copy of the Server Side Public License
   14  * along with this program. If not, see
   15  * <http://www.mongodb.com/licensing/server-side-public-license>.
   16  */
   17 // @flow strict
   18 import * as React from 'react';
   19 
   20 export type ActionContexts = { [string]: * };
   21 
   22 const ActionContext = React.createContext<ActionContexts>({});
   23 
   24 type Props = {
   25   children: React.Node,
   26   value: ActionContexts;
   27 };
   28 
   29 const AdditionalContext = {
   30   Provider: ({ children, value }: Props) => (
   31     <ActionContext.Consumer>
   32       {(contexts) => (
   33         <ActionContext.Provider value={{ ...contexts, ...value }}>
   34           {children}
   35         </ActionContext.Provider>
   36       )}
   37     </ActionContext.Consumer>
   38   ),
   39   Consumer: ActionContext.Consumer,
   40 };
   41 
   42 export { ActionContext, AdditionalContext };