@leafage/toolkit
Version:
The React Server Side Render Framework
25 lines (21 loc) • 615 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
*/
;
var node_async_hooks = require('node:async_hooks');
var asyncLocalStorage = new node_async_hooks.AsyncLocalStorage();
var runWithContext = function runWithContext(context, fn) {
return asyncLocalStorage.run(context, fn);
};
var useContext = function useContext() {
return asyncLocalStorage.getStore();
};
exports.runWithContext = runWithContext;
exports.useContext = useContext;