Home

Awesome

observe-hafas-client

Observe all departures/arrivals/etc. returned by a hafas-client instance.

npm version build status ISC-licensed chat with me on Gitter support me on Patreon

Installation

npm install observe-hafas-client

Usage

const createHafas = require('db-hafas')
const {EventEmitter} = require('events')
const observe = require('observe-hafas-client')

const hafas = createHafas('my-awesome-program')

// set up observing
const observer = new EventEmitter()
observer.on('departure', console.log)
const observedHafas = observe(hafasClient, observer, {departures: true})

// query data from HAFAS
observedHafas.departures('8011160') // Berlin Hbf
.then(console.log)
.catch(console.error)

API

observeHafasClient(hafas, emitter, watch)

hafas must be a hafas-client instance. emitter must be an event emitter. watch must be an object with one or more flags of the following list set to true:

Contributing

If you have a question or need support using observe-hafas-client, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.