Ninja Pumpkin Mutants

    quasar-app-extension-onesignal

    0.3.0 • Public • Published

    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()
          }
        }
      )
    

    Install

    npm i quasar-app-extension-onesignal

    DownloadsWeekly Downloads

    8

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    9.67 kB

    Total Files

    9

    Last publish

    Collaborators

    • motia