resolve-local-event-broker
Version:
The reSolve framework's event broker for applications on a local machine.
30 lines (24 loc) • 720 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const multiplexAsync = (targetFunction, ...args) => {
if (typeof targetFunction !== 'function') {
throw new Error(`Entity ${targetFunction} is not a function`);
}
;
(async () => {
try {
await Promise.resolve();
await targetFunction(...args);
} catch (error) {
// eslint-disable-next-line no-console
console.warn(`Async multiplexed function ${targetFunction.name} failed with error: ${error.message}\n${error.stack}`);
}
})();
return Promise.resolve();
};
var _default = multiplexAsync;
exports.default = _default;
//# sourceMappingURL=multiplex-async.js.map