Skip to content

Vue OneSignal Plugin: Make it easy to integrate OneSignal with your Vue App!

Notifications You must be signed in to change notification settings

K-Bit-dev/onesignal-vue-3

 
 

Repository files navigation

onesignal-vue-3

This is a fork of the official onesignal-vue package that has been altered to work with vue3.

Add the following to your main.ts file:

import { createApp } from 'vue';
import OneSignalVue from 'onesignal-vue-3';

createApp(App)
  .use(OneSignalVue, {
    appId: process.env.VUE_APP_ONESIGNAL_APP_ID,
  })
  .mount('#app')

And use the following code in one of your Vue components:

<script lang="ts">
import { onMounted, defineComponent } from 'vue'
import { useOneSignal } from 'onesignal-vue-3'

export default defineComponent({
    setup() {
        const oneSignal = useOneSignal()

        onMounted(async () => {
            await oneSignal.registerForPushNotifications({
                modalPrompt: true,
            })
        })
    }
})
</script>

Please check the docs of the original package to find out more information about possible configurations and usages.

About

Vue OneSignal Plugin: Make it easy to integrate OneSignal with your Vue App!

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.0%
  • JavaScript 3.0%