mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
departures/arrivals: add line option
This commit is contained in:
parent
53e10f73b7
commit
e6bc8c6f86
3 changed files with 10 additions and 3 deletions
|
@ -26,6 +26,7 @@ With `opt`, you can override the default options, which look like this:
|
|||
// todo: products
|
||||
when: new Date(),
|
||||
direction: null, // only show departures heading to this station
|
||||
line: null, // filter by line ID
|
||||
duration: 10, // show departures for the next n minutes
|
||||
results: null, // max. number of results; `null` means "whatever HAFAS wants"
|
||||
subStops: true, // parse & expose sub-stops of stations?
|
||||
|
|
|
@ -3,15 +3,20 @@
|
|||
const formatStationBoardReq = (ctx, station, type) => {
|
||||
const {profile, opt} = ctx
|
||||
|
||||
const jnyFltrL = [
|
||||
profile.formatProductsFilter(ctx, opt.products || {})
|
||||
]
|
||||
if (opt.line !== null) {
|
||||
jnyFltrL.push({type: 'LINEID', mode: 'INC', value: opt.line})
|
||||
}
|
||||
|
||||
const req = {
|
||||
type,
|
||||
date: profile.formatDate(profile, opt.when),
|
||||
time: profile.formatTime(profile, opt.when),
|
||||
stbLoc: station,
|
||||
dirLoc: opt.direction ? profile.formatStation(opt.direction) : null,
|
||||
jnyFltrL: [
|
||||
profile.formatProductsFilter(ctx, opt.products || {})
|
||||
],
|
||||
jnyFltrL,
|
||||
dur: opt.duration
|
||||
}
|
||||
if (opt.results !== null) {
|
||||
|
|
1
index.js
1
index.js
|
@ -56,6 +56,7 @@ const createClient = (profile, userAgent, opt = {}) => {
|
|||
opt = Object.assign({
|
||||
// todo: for arrivals(), this is actually a station it *has already* stopped by
|
||||
direction: null, // only show departures stopping by this station
|
||||
line: null, // filter by line ID
|
||||
duration: 10, // show departures for the next n minutes
|
||||
results: null, // max. number of results; `null` means "whatever HAFAS wants"
|
||||
subStops: true, // parse & expose sub-stops of stations?
|
||||
|
|
Loading…
Add table
Reference in a new issue