Installation
Install the walkerOS node source, via NPM:
npm install @elbwalker/source-node
Use the createSourceNode
function to create a new source instance. It returns
the elb
function for configuration
via commands and pushing
events, and the instance
itself.
import { createSourceNode } from '@elbwalker/source-node';
const { elb, instance } = createSourceNode({});
Configuration
There a few configuration options when creating a node source instance:
Option | Type | Description |
---|---|---|
consent | object | Initial consent states |
custom | object | Individual information |
destinations | object | Destinations that might process the events |
globalsStatic | object | Static values for the globals that persist new runs |
onError | function | custom error handler |
onLog | function | custom logging for the verbose mode |
source | object | To define the events origin (type , id , previous_id ) |
verbose | boolean | To enable verbose mode |
const { instance } = createSourceNode({
consent: {
functional: true,
},
custom: {
foo: 'bar',
},
destinations: {
log: {
type: 'log',
push: console.log,
},
},
globalsStatic: {
version: '3.1.4',
},
onError: (error) => {
console.error('node source', error);
},
onLog: (message) => {
console.log('node source', message);
},
source: {
type: 'server',
id: '',
previous_id: '',
},
verbose: true,
});