UNPKG

@caspingus/lt

Version:

A utility library of helpers and extensions useful when working with Learnosity APIs.

34 lines (33 loc) 643 B
//#region src/utils/extensionsFactory.js var e = null; function t(t, n, r) { e = t; } function n(e, t, n = {}) { let i = !1, a = null; function o(...n) { if (i) return a ?? void 0; r("extension:run", e); try { let e = t(...n); return i = !0, e && typeof e.then == "function" ? (a = e, a) : (a = Promise.resolve(), e); } catch (e) { throw i = !1, e; } } return { name: e, run: o, hasRun: () => i, ...n }; } function r(e, t, n = {}) { typeof window < "u" && window.dispatchEvent(new CustomEvent(e, { detail: { name: t, timestamp: Date.now(), ...n } })); } //#endregion export { t as n, n as r, e as t };