@graffiti-garden/wrapper-vue 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/plugin.mjs +148 -148
- package/dist/browser/plugin.mjs.map +1 -1
- package/dist/node/globals.d.ts +5 -3
- package/dist/node/globals.d.ts.map +1 -1
- package/dist/node/plugin.d.ts.map +1 -1
- package/dist/node/plugin.js +1 -1
- package/dist/node/plugin.js.map +1 -1
- package/dist/node/plugin.mjs +97 -97
- package/dist/node/plugin.mjs.map +1 -1
- package/package.json +3 -3
- package/src/globals.ts +7 -8
- package/src/plugin.ts +3 -3
package/src/globals.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { InjectionKey, Ref } from "vue";
|
|
1
|
+
import type { Ref } from "vue";
|
|
3
2
|
import type { Graffiti, GraffitiSession } from "@graffiti-garden/api";
|
|
4
3
|
import type { GraffitiSynchronize } from "@graffiti-garden/wrapper-synchronize";
|
|
5
4
|
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
Ref<GraffitiSession | undefined | null
|
|
9
|
-
|
|
5
|
+
export const globals: {
|
|
6
|
+
graffitiSynchronize?: GraffitiSynchronize;
|
|
7
|
+
graffitiSession?: Ref<GraffitiSession | undefined | null>;
|
|
8
|
+
} = {};
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Returns the global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance
|
|
@@ -14,7 +13,7 @@ export const graffitiSessionInjectKey = Symbol() as InjectionKey<
|
|
|
14
13
|
* @throws If the {@link GraffitiPlugin} is not installed
|
|
15
14
|
*/
|
|
16
15
|
export function useGraffitiSynchronize() {
|
|
17
|
-
const graffiti =
|
|
16
|
+
const graffiti = globals.graffitiSynchronize;
|
|
18
17
|
if (!graffiti) {
|
|
19
18
|
throw new Error(
|
|
20
19
|
"No Graffiti instance provided, did you forget to install the plugin?",
|
|
@@ -57,7 +56,7 @@ export function useGraffiti(): Graffiti {
|
|
|
57
56
|
* @throws If the {@link GraffitiPlugin} is not installed
|
|
58
57
|
*/
|
|
59
58
|
export function useGraffitiSession() {
|
|
60
|
-
const session =
|
|
59
|
+
const session = globals.graffitiSession;
|
|
61
60
|
if (!session) {
|
|
62
61
|
throw new Error(
|
|
63
62
|
"No Graffiti session provided, did you forget to install the plugin?",
|
package/src/plugin.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
GraffitiLogoutEvent,
|
|
11
11
|
GraffitiSessionInitializedEvent,
|
|
12
12
|
} from "@graffiti-garden/api";
|
|
13
|
-
import {
|
|
13
|
+
import { globals } from "./globals";
|
|
14
14
|
import type { Router } from "vue-router";
|
|
15
15
|
import { GraffitiSynchronize } from "@graffiti-garden/wrapper-synchronize";
|
|
16
16
|
|
|
@@ -214,8 +214,8 @@ export const GraffitiPlugin: Plugin<GraffitiPluginOptions> = {
|
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
globals.graffitiSynchronize = graffiti;
|
|
218
|
+
globals.graffitiSession = graffitiSession;
|
|
219
219
|
|
|
220
220
|
app.component("GraffitiDiscover", Discover);
|
|
221
221
|
app.component("GraffitiGet", Get);
|