Skip to content

opus-hero/quasar-app-extension-onesignal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quasar App Extension OneSignal

Adds onesignal push notifications to quasar framework apps.

web,pwa and corodova are supported

Setup

yarn add quasar-app-extension-onesignal
quasar ext invoke onesignal

PWA mode

For pwa mode, edit the generated src-pwa/register-service-worker.js and change register(process.env.SERVICE_WORKER_FILE, { to register('/OneSignalSDKWorker.js', {

API

Extends vue components and the app with $oneSignal:

    $vm.$oneSignal === {
        get Instance (): Object|Array; // returns window.OneSignal
        setup (appId: string, initConfig?: Object) ;
        optIn (extenalUserId?: string);
        optout ();
    }

Usage

  // setup one signal
  app.$oneSignal.setup(process.env.ONESIGNAL_APP_ID)

  store.watch(
    () => store.state.auth.user,
    function (user) {
      if (user) {
        // optin using an optional external_user_id
        app.$oneSignal.optIn(user.push_id)
      } else {
        // optout
        app.$oneSignal.optOut()
      }
    }
  )

About

Adds onesignal push notifications to quasar framework apps.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%