UNPKG

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.22 kB
import o from"spur-monocle-manager";import{inject as n}from"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)}};function i(){const o=n(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)}}}export{e as MonocleKey,t as default,i as useMonocle}; //# sourceMappingURL=index.esm.js.map