Skip to content

Commit 68ef0b2

Browse files
stijnie2210adriaandotcom
authored andcommitted
Added injectionkey
1 parent a2b0044 commit 68ef0b2

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* globals document */
2+
export const saEventKey = Symbol('saEvent');
23

34
const isPromise = (subject) =>
45
subject && subject.then && typeof subject.then == "function";

types/index.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { App, Plugin } from 'vue'
1+
import type { App, Plugin, InjectionKey } from 'vue'
22

33
declare global {
44
interface Window {
@@ -11,16 +11,17 @@ export interface SimpleAnalyticsOptions {
1111
domain?: string;
1212
}
1313

14+
export declare const saEventKey: InjectionKey<(event: string) => void>;
15+
1416
type SimpleAnalyticsPlugin = Plugin & {
1517
install(app: App, options?: SimpleAnalyticsOptions): void;
1618
}
1719

1820
declare const SimpleAnalytics: SimpleAnalyticsPlugin;
19-
2021
export default SimpleAnalytics;
2122

2223
declare module '@vue/runtime-core' {
23-
interface ComponentCustomProperties {
24-
$saEvent?: (event: string) => void;
24+
interface InjectionKeys {
25+
saEvent: (event: string) => void;
2526
}
2627
}

0 commit comments

Comments
 (0)