const PA = new themeparks.Parks.PortAventura();
PA.on('rideStateUpdated', (ride, previousTime, previousStatus) => {
console.log(`${ride.name} was ${previousTime}, now ${ride.waitTime} (${previousStatus} => ${ride.status})`);
});
PA.StartPolling();
previousTime and previousStatus return undefined if this is the first update of a process run.
This does a few things:
Avoids people manually setting up less-than-ideal timer loops where developers reinstantiate park objects multiple times, or call update too frequently
Encourages developers to not attach GetWaitTimes directly to public API calls (i.e, app HTTP calls are calling GetWaitTimes directly, which has unknown side-effects based on park state, should be returning cached results instead)
Allows live-response parks (WDW & DL) to return park results in real-time, rather than waiting for poll requests by developers to give updated times
Still need to test thoroughly, as now all parks are EventEmitters, which is new.
Also need to check over live Disney parks and ensure they flush their temporary cache when live rides come through.
Proposed example usage:
previousTime and previousStatus return undefined if this is the first update of a process run.
This does a few things:
Still need to test thoroughly, as now all parks are EventEmitters, which is new. Also need to check over live Disney parks and ensure they flush their temporary cache when live rides come through.