bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/components-data/plugin-context/context.tsx

28 lines
1010 B
TypeScript
Raw Normal View History

2023-09-14 01:34:48 +08:00
import React, { createContext, useState } from 'react';
import { ExtensibleArea } from '/imports/ui/components/plugins-engine/extensible-areas/types';
import { PluginsContextType } from './types';
export const PluginsContext = createContext<PluginsContextType>({} as PluginsContextType);
2023-09-14 01:34:48 +08:00
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const PluginsContextProvider = ({ children, ...props }: any) => {
const [pluginsExtensibleAreasAggregatedState, setPluginsExtensibleAreasAggregatedState] = useState<ExtensibleArea>(
{} as ExtensibleArea,
2023-09-14 01:34:48 +08:00
);
const [domElementManipulationMessageIds, setDomElementManipulationMessageIds] = useState<string[]>([]);
2023-09-14 01:34:48 +08:00
return (
2023-09-14 01:34:48 +08:00
<PluginsContext.Provider
value={{
...props,
setPluginsExtensibleAreasAggregatedState,
pluginsExtensibleAreasAggregatedState,
domElementManipulationMessageIds,
setDomElementManipulationMessageIds,
2023-09-14 01:34:48 +08:00
}}
>
2023-09-14 01:34:48 +08:00
{children}
</PluginsContext.Provider>
);
};