leafage
Version:
The React Server Side Render Framework
43 lines (39 loc) • 1.1 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
*/
;
var hookable = require('hookable');
var toolkit = require('@leafage/toolkit');
var createContext = function createContext(options) {
var hooks = hookable.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 toolkit.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(fn) {
return toolkit.runWithContext(context, fn);
}
};
return context;
};
exports.createContext = createContext;