Skip to content

Commit

Permalink
Merge pull request #8 from innocenzi/refactor/no-provide-inject
Browse files Browse the repository at this point in the history
refactor: do not use `provide`/`inject`
  • Loading branch information
rgomezp authored Jun 13, 2022
2 parents b00bdf0 + fdbf1b4 commit 88efa85
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, inject } from 'vue';
import { App } from 'vue';

const ONESIGNAL_SDK_ID = 'onesignal-sdk';
const ONE_SIGNAL_SCRIPT_SRC = 'https://cdn.onesignal.com/sdks/OneSignalSDK.js';
Expand Down Expand Up @@ -874,17 +874,14 @@ const OneSignalVue: IOneSignal = {
sendOutcome,
};

const INJECT_KEY = "onesignal";

export const useOneSignal = () => {
return inject(INJECT_KEY);
return OneSignalVue;
}

const OneSignalVuePlugin = {
install(app: App, options: IInitObject) {
app.config.globalProperties.$OneSignal = OneSignalVue as IOneSignal;
app.config.globalProperties.$OneSignal.init(options);
app.provide(INJECT_KEY, OneSignalVue);
}
}

Expand Down

0 comments on commit 88efa85

Please sign in to comment.