SDK emits events for every major...events 😄 so you can easily subscribe on them and provide your own callbacks.
{.toc}
{#subscribing}
It is extremely easy to subscribe to SDK events:
Notimatica.push(['on', 'subscribe:success', function () {
alert('From now you are subscribed to notifications!')
}])
First argument is method on()
, second is an event name, third is a callback.
{#public-events}
{.table .table-bordered .table-striped}
Event | Vars | Description |
---|---|---|
ready |
- | Notimatica SDK is fully loaded and ready for action |
unsupported |
{String} message | User's browser doesn't support notifications |
warning |
{String} message | Warning was emitted |
error |
{*} err | Error was emitted |
subscribe:start |
- | User started subscription |
subscribe:success |
{String} user's Notimatica internal uuid | User successfully subscribed |
subscribe:fail |
{*} err | Something failed subscription process |
unsubscribe:start |
- | User started unsubscribing |
unsubscribe:success |
- | User successfully unsubscribed |
unsubscribe:fail |
{*} err | For some reason user failed to unsubscribe |
{#internal-events}
{.table .table-bordered .table-striped}
Event | Vars | Description |
---|---|---|
driver:ready |
{Object} driver | Push notifications driver inited and ready |
plugin:ready |
{Object} plugin | Plugin was loaded and ready to init |
autorun:disable |
- | If SDK should disable autorun forever |
iframe:ready |
- | If HTTP fallback iframe is loaded |
subscribe:subscription |
{String} browser's endpoint | Driver received browser's endpoint |
register:start |
{Object} user's data | SDK makes attempt to register user in Notimatica |
register:success |
{Object} Notimatica user | Registration succeeded |
register:fail |
{*} err | Registration failed |
unregister:start |
- | SDK makes attempt to unregister from Notimatica |
unregister:success |
- | Notimatica forgot about user |
unregister:fail |
{*} err | Notimatica failed to unregister user |