npm

Need private packages and team management tools?Check out npm Orgs. »

hafas-monitor-trips

2.2.0 • Public • Published

hafas-monitor-trips

Using a HAFAS endpoint, watch all trips in a bounding box.

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

Installation

npm install hafas-monitor-trips

Usage

const createHafas = require('vbb-hafas')
const createMonitor = require('hafas-monitor-trips')
 
const hafas = createHafas('hafas-monitor-trips example')
const monitor = createMonitor(hafas, {
    north: 52.52,
    west: 13.36,
    south: 52.5,
    east: 13.39
})
 
monitor.on('stopover', stopover => console.log(stopover))
monitor.on('error', console.error)
monitor.on('stats', console.error)
// monitor.on('trip', trip => console.log(trip))
// monitor.on('new-trip', (tripId, t) => console.log('going to watch trip', tripId, t.line.name))
// monitor.on('trip-obsolete', (tripId, t) => console.log('not watching trip anymore', tripId, t.line.name))

Once you listen to any of trip/new-trip/trip-obsolete/stopover/position/stats, the monitor will automatically start to watch. Once you stop listening to each, the monitor will stop again.

Contributing

If you have a question or need support using hafas-monitor-trips, 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.

install

npm i hafas-monitor-trips

Downloadsweekly downloads

79

version

2.2.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability