1.0.11 • Published 4 years ago

orki-notification v1.0.11

Weekly downloads
13
License
MIT
Repository
-
Last release
4 years ago

orki-notification

Projeto para facilitar a integração com o recurso de notificação do orki framework

Instalação

npm i orki-notification --save

Import

import notification from 'orki-notification'

Exemplos

Configurando endpoint e token

/**
 * Configure
 */
notification.set('endpoint', environment.apiUrl)
notification.set('token', () => localStorage.getItem('jwt'))

Abrindo escuta a um schema.

notification.open('module', 'SCHEMA', { scope: 'myScope' })
    .then(socket => {
        socket.on('message', function(a){
            // Um exemplo de como fechar a conexão websocket
            setTimeout(socket.close.bind(socket), 1000 * 10)
        })
    })

Abrindo escuta a um schema usando async e await.

const socket = await notification.open('module', 'SCHEMA', { scope: 'myScope' })
    
socket.on('message', function(a){
    // Um exemplo de como fechar a conexão websocket
    setTimeout(socket.close.bind(socket), 1000 * 10)
})
1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago