From fbec080f86874c53cc373c8a3b9e68e056186709 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 28 Dec 2022 15:21:21 +0100 Subject: [PATCH] =?UTF-8?q?example:=20use=20top-level=20await=20?= =?UTF-8?q?=F0=9F=93=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example.js | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/example.js b/example.js index 12893b1..701c60e 100644 --- a/example.js +++ b/example.js @@ -15,35 +15,42 @@ const hafas = createHafas('bvg-hafas-example') const spichernstr = '900000042101' const bismarckstr = '900000024201' -hafas.journeys(spichernstr, bismarckstr, { +// let data = await hafas.locations('Alexanderplatz', {results: 2}) +// let data = await hafas.nearby(52.5137344, 13.4744798, {distance: 60}) +// let data = await hafas.stop(bismarckstr) +// let data = await hafas.departures(spichernstr, {duration: 1}) + +let data = await hafas.journeys(spichernstr, bismarckstr, { results: 1, tickets: true, stopovers: true, transferInfo: true }) - -// hafas.journeys({ +// let data = await hafas.journeys({ // type: 'location', // id: '900981377', // name: 'Berlin, HTW-Berlin Campus Wilhelminenhof', // latitude: 52.458359, // longitude: 13.526635 // }, '900000192001', {results: 1}) -// hafas.departures('900000013102', {duration: 1}) -// hafas.locations('Alexanderplatz', {results: 2}) -// hafas.stop('900000017104') -// hafas.nearby(52.5137344, 13.4744798, {distance: 60}) -// hafas.radar({ +// { +// const [journey] = data.journeys +// data = await hafas.refreshJourney(journey.refreshToken, { +// stopovers: true, +// transferInfo: true, +// }) +// } +// { +// const [journey] = data.journeys +// const leg = journey.legs[0] +// data = await hafas.trip(leg.tripId, leg.line.name, {polyline: true}) +// } + +// let data = await hafas.radar({ // north: 52.52411, // west: 13.41002, // south: 52.51942, // east: 13.41709 // }, {results: 10}) -.then((data) => { - console.log(inspect(data, {depth: null, colors: true})) -}) -.catch((err) => { - console.error(err) - process.exitCode = 1 -}) +console.log(inspect(data, {depth: null, colors: true}))