leafage
Version:
The React Server Side Render Framework
41 lines (38 loc) • 1.06 kB
JavaScript
/**
* leafage v1.3.1
*
* 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 { createHooks } from 'hookable';
import { runWithContext } from '@leafage/toolkit';
var createContext = function createContext(options) {
var hooks = createHooks();
// eslint-disable-next-line no-use-before-define
var callHook = function callHook() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return runWithContext(context, function () {
return hooks.callHook.apply(hooks, args);
});
};
var context = {
version: "1.3.1",
options: options,
hook: hooks.hook,
callHook: callHook,
close: function close() {
return callHook('close', context);
},
runWithContext: function runWithContext$1(fn) {
return runWithContext(context, fn);
}
};
return context;
};
export { createContext };