pusher / push-notifications-web

Beams Browser notifications
MIT License
39 stars 19 forks source link

Experiment: hide notification based on deep link or URL #58

Closed TomKemp closed 4 years ago

TomKemp commented 4 years ago

We could trigger notifications with a payload like this:

 web: {
      notification: {
        title: '🍕 Pusher Pizza',
        body: 'Pizza status: ' + state,
        deep_link: '/?id='+id,
        hide_notification_if_page_has_focus: {
          mode: "deep_link",
          ignore_all_query_parameters: false,
          ignore_fragment: false,
          ignore_protocol: false,
        },
        icon: 'http://localhost:3000/icon_128x128@2x.png'
      }
    }

And notifications won't show if the "deep_link" page is open.