Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/react-dnd/lib/common/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import * as React from 'react';
import { memo } from 'react';
import { DndContext, createDndContext } from './DndContext';
let refCount = 0;
/**
* A React component that provides the React-DnD context
*/
export const DndProvider = memo(({ children, ...props }) => {
const [manager, isGlobalInstance] = getDndContextValue(props); // memoized from props
/**
* If the global context was used to store the DND context
* then where theres no more references to it we should
* clean it up to avoid memory leaks
*/
React.useEffect(() => {
if (isGlobalInstance) {
refCount++;
}
return () => {
if (isGlobalInstance) {
refCount--;
if (refCount === 0) {
const context = getGlobalContext();
context[instanceSymbol] = null;
}
}
};
}, []);
return React.createElement(DndContext.Provider, { value: manager }, children);
});
DndProvider.displayName = 'DndProvider';
function getDndContextValue(props) {
if ('manager' in props) {
const manager = { dragDropManager: props.manager };
return [manager, false];
}
const manager = createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);
const isGlobalInstance = !props.context;
return [manager, isGlobalInstance];
}
const instanceSymbol = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');
function createSingletonDndContext(backend, context = getGlobalContext(), options, debugMode) {
const ctx = context;
if (!ctx[instanceSymbol]) {
ctx[instanceSymbol] = createDndContext(backend, context, options, debugMode);
}
return ctx[instanceSymbol];
}
function getGlobalContext() {
return typeof global !== 'undefined' ? global : window;
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0241 ]-- |