vue-spur-monocle
Version:
> **Note:** This is **not** an official package. For the official Monocle documentation, please visit: [https://docs.spur.us/monocle](https://docs.spur.us/monocle)
3 lines (2 loc) • 1.29 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var o=require("spur-monocle-manager"),n=require("vue");const e=Symbol("monocle"),t={install(n,t){let i;if("undefined"==typeof window)return i={init:async()=>{},getAssessment:async()=>{throw new Error("Monocle not available in SSR")},on:()=>{},off:()=>{}},n.config.globalProperties.$monocle=i,void n.provide(e,i);if(n.config.globalProperties.$monocle)return void console.warn("[MonoclePlugin] already installed on this app instance.");const r=new o(t);n.config.globalProperties.$monocle=r,n.provide(e,r)}};exports.MonocleKey=e,exports.default=t,exports.useMonocle=function(){const o=n.inject(e);if(!o)throw new Error("[Monocle] instance not found: did you include the boot file?");return{init:async function(){if(!o)throw new Error("[Monocle] instance not found: did you include the boot file?");await o.init()},getAssessment:async function(){if(!o)throw new Error("[Monocle] instance not found: did you include the boot file?");return o.getAssessment()},on:function(n,e){if(!o)throw new Error("[Monocle] instance not found: did you include the boot file?");o.on(n,e)},off:function(n,e){if(!o)throw new Error("[Monocle] instance not found: did you include the boot file?");o.off(n,e)}}};
//# sourceMappingURL=index.cjs.js.map