@leafage/toolkit
Version:
The React Server Side Render Framework
22 lines (19 loc) • 550 B
JavaScript
/**
* @leafage/toolkit v1.3.2
*
* Copyright (c) Leafage.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import { AsyncLocalStorage } from 'node:async_hooks';
var asyncLocalStorage = new AsyncLocalStorage();
var runWithContext = function runWithContext(context, fn) {
return asyncLocalStorage.run(context, fn);
};
var useContext = function useContext() {
return asyncLocalStorage.getStore();
};
export { runWithContext, useContext };