solinftec-notification-lib
TypeScript icon, indicating that this package has built-in type declarations

1.3.3 • Public • Published
health-check circle-ci travis-ci npm-version

notification lib

Library to receive notifications from notification-api.

install

npm

npm i solinftec-notification-lib --save

cdn

<!-- versioned -->
<script src='https://solinftec-notify.s3-sa-east-1.amazonaws.com/script/X.X.X/notification.min.js'></script>

<!-- last -->
<script src='https://solinftec-notify.s3-sa-east-1.amazonaws.com/script/last/notification.min.js'></script>

import

node

import Notification from 'solinftec-notification-lib';

react-native

import Notification from 'solinftec-notification-lib/react-native';

define options

const options =
{   
    show_log?:boolean, //to show log (default is false)
    multiple_subscribe?:boolean, //to do multiples subscribes in same channel (default is false)
    url?:string //to set other url (default is prd url)
};

init

const notification_lib = new Notification('app-key', 'server', 'token', options?);

using

setting a function to a specific channel

notification_lib.subscribe('channel_name', (notification) => 
{
    //do something with the notification
});

set function to a specific channel

setting a source of function by channel

let source_map = 
[
    { 
        'channel':'channel_a' 
        'callback': (notification) => 
        {
            //do something with the notification
        }
    }
    ,
    { 
        'channel':'channel_b' 
        'callback': (notification) => 
        {
            //do something with the notification
        }
    }
];

notification_lib.setSourceOfFunctionByChannel(source_map);

set source of function by channel

Readme

Keywords

Package Sidebar

Install

npm i solinftec-notification-lib

Weekly Downloads

1

Version

1.3.3

License

none

Unpacked Size

1.49 MB

Total Files

28

Last publish

Collaborators

  • jonathan-sh