No async in new Promise

This commit is contained in:
McToel 2025-02-19 00:17:48 +01:00
parent f1d226e9c8
commit c951466597

View file

@ -26,10 +26,10 @@ const validateLocation = (loc, name = 'location') => {
} }
}; };
const loadEnrichedStationData = (profile) => new Promise(async (resolve, reject) => { const loadEnrichedStationData = (profile) => new Promise((resolve, reject) => {
const { default: readStations} = await import('db-hafas-stations'); import('db-hafas-stations').then(m => {
const items = {}; const items = {};
readStations.full() m.default.full()
.on('data', (station) => { .on('data', (station) => {
items[station.id] = station; items[station.id] = station;
items[station.name] = station; items[station.name] = station;
@ -43,6 +43,7 @@ const loadEnrichedStationData = (profile) => new Promise(async (resolve, reject)
.once('error', (err) => { .once('error', (err) => {
reject(err); reject(err);
}); });
});
}); });
const createClient = (profile, userAgent, opt = {}) => { const createClient = (profile, userAgent, opt = {}) => {