Skip to main content

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:

OptionTypeDescription
consentobjectInitial consent states
customobjectIndividual information
destinationsobjectDestinations that might process the events
globalsStaticobjectStatic values for the globals that persist new runs
onErrorfunctioncustom error handler
onLogfunctioncustom logging for the verbose mode
sourceobjectTo define the events origin (type, id, previous_id)
verbosebooleanTo 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,
});