}
})
+ // Expose pinia instance as $pinia to window
+ globalThis.$pinia = pinia
+
api.on.getInspectorState((payload) => {
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
const inspectedStore =
}
if (inspectedStore) {
+ // Expose selected store as $store to window
+ if (payload.nodeId !== PINIA_ROOT_ID)
+ globalThis.$store = toRaw(inspectedStore as StoreGeneric)
payload.state = formatStoreForInspectorState(inspectedStore)
}
}
store as StoreGeneric
)
}
+
+declare global {
+ /**
+ * Exposes the `pinia` instance when Devtools are opened.
+ */
+ var $pinia: Pinia | undefined
+ /**
+ * Exposes the current store when Devtools are opened.
+ */
+ var $store: StoreGeneric | undefined
+}