raven client interop
npm i raven-client --save
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'
});
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...
});
namespace, global object
-
active
{boolean}: is true if raven is active -
constants
{object}: contains some raven constants -
getPosition
{function}: manage location to obtains aRavenAppPosition
object
-
state(data [, options]) => {promise}
send client data and retrieve (by promise) container infoconst 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
-
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}:
-
firstDayOfWeek
{number}: -
date
{string}:
-
decimalSeparator
{string}: -
defaultCurrency
{string}: -
thousandsSeparator
{string}:
-
locale
{string}: -
rtlEnabled
{boolean}: -
dateTimeOptions
{RavenUserDateTimeOptions}: -
numbersOptions
{RavenUserNumbersOptions}:
type: 'action' | 'state' | 'loaded' | 'position' | 'warning' | 'error' | 'info' | 'success';
type: 'action' | 'browser' | 'message';
-
endpoint
{string}: -
method
{string}: -
useProxy
{boolean}: -
bodyTemplate
{string}: -
headers
{string}: -
useCallerHeaders
{boolean}: -
responseType
{string}:
-
loadedMode?
{RavenAppLoadedMode}: -
aboutRequest?
{RavenRequest|string}: -
aboutInfo?
{any}:
-
action?
{string}: -
path?
{string|string[]}: -
url?
{string}: -
data?
{any}:
-
name?
{string}: -
version?
{string}: -
options?
{RavenAppOptions}: -
[pn: string]
{any}: