1.1.4 • Published 1 year ago

raven-client v1.1.4

Weekly downloads
123
License
MIT
Repository
github
Last release
1 year ago

RAVEN Client

raven client interop

install

npm i raven-client --save

USE

AngularJS / jQuery / native JS (ES5)

reference (index.html):

  <script src="./node_modules/raven-client/raven.js"></script>

use case (raven events subscribing):

  raven.subscribe(function(data) {
      // use action: data.action
      // ....
    });

use case (raven state):

  raven.state({
    name: 'My application name',
    version: 'x.xx.xxx'
  }).then(function(data) {
    // container data info...
  }, function(err) {
    // error handler...
  });

use case (raven message loaded):

  raven.send({
    type: 'loaded'
  });

Angular 2+ (ES6)

reference:

import { raven } from 'raven-client/raven';

consider raven an external angular implementation, so you have to resync events in angular scope:

import { ..., NgZone} from '@angular/core';
import { raven, RavenAppInfo, RavenAppPosition, RavenMessage, RavenMessageType } from 'raven-client/raven';

@Component({
  ...
})
export class MyComponent {
  constructor(...,
              private _zone: NgZone) {
    ...
  }

  myMethod() {
    ...
    raven.subscribe(data => this._zone.run(() => {
      // use action: data.action
      // ....
    }));
  }
...

use case (raven state):

  raven.state({
    name: 'My application name',
    version: 'x.xx.xxx',
    options: {}
  }).then(data => {
    // container data info...
  }, err => {
    // error handler...
  });

HOW TO

istructions (ITA)

API

raven

namespace, global object

properties

  • active {boolean}: is true if raven is active

  • constants {object}: contains some raven constants

  • getPosition {function}: manage location to obtains a RavenAppPosition object

methods

  • state(data [, options]) => {promise} send client data and retrieve (by promise) container info

    const clientData = {
      name: 'My application name',
      version: 'x.xx.xxx',
      options: {}
    };
    raven.state(clientData)
      .then(serverData => {
        serverData.token      // server authentication token
        serverData.user       // logged user name
      }, err => {
        // error handler...
      })
  • send(message) send a message to Raven

  • subscribe(callback [, filter]) subscribes callback to raven events filtering (optional) by specific function (filter)

  • unsubscribe(callback) unsubscribes callback

RavenMessage

properties

  • owner {string}:

  • token {string}:

  • user {string}:

  • roles {string[]}:

  • locale {string}:

  • options {Partial}:

  • theme {string}:

  • id {string}:

  • data {any}:

  • action {string}:

  • type {RavenMessageType}:

  • error {any}:

  • context {any}:

  • channel {string}:

  • debug {boolean}:

RavenUserDateTimeOptions

properties

  • firstDayOfWeek {number}:

  • date {string}:

RavenUserNumbersOptions

properties

  • decimalSeparator {string}:

  • defaultCurrency {string}:

  • thousandsSeparator {string}:

RavenUserOptions

properties

  • locale {string}:

  • rtlEnabled {boolean}:

  • dateTimeOptions {RavenUserDateTimeOptions}:

  • numbersOptions {RavenUserNumbersOptions}:

RavenMessageType

type: 'action' | 'state' | 'loaded' | 'position' | 'warning' | 'error' | 'info' | 'success';

RavenAppLoadedMode

type: 'action' | 'browser' | 'message';

RavenRequest

properties

  • endpoint {string}:

  • method {string}:

  • useProxy {boolean}:

  • bodyTemplate {string}:

  • headers {string}:

  • useCallerHeaders {boolean}:

  • responseType {string}:

RavenAppOptions

properties

  • loadedMode? {RavenAppLoadedMode}:

  • aboutRequest? {RavenRequest|string}:

  • aboutInfo? {any}:

RavenAppPosition

properties

  • action? {string}:

  • path? {string|string[]}:

  • url? {string}:

  • data? {any}:

RavenAppInfo

properties

  • name? {string}:

  • version? {string}:

  • options? {RavenAppOptions}:

  • [pn: string] {any}:

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago