Skip to content

Instantly share code, notes, and snippets.

@DougSisk
Created May 14, 2019 00:14
Show Gist options
  • Save DougSisk/42e2367807fc49aac627c2f53e14a396 to your computer and use it in GitHub Desktop.
Save DougSisk/42e2367807fc49aac627c2f53e14a396 to your computer and use it in GitHub Desktop.
const moment = require('moment-timezone')
const Themeparks = require('themeparks')
const MagicKingdom = new Themeparks.Parks.WaltDisneyWorldMagicKingdom()
const statusChannel = MagicKingdom.FacilityStatusChannel
const startLiveMonitor = () => {
statusChannel.on('updated', ride => {
const currentTime = moment().format('LTS')
MagicKingdom.FacilityChannel.GetFacilityName(ride.id).then(rideName => {
console.log('[' + currentTime + '] ' + rideName + ': ' + ride.waitMinutes)
})
})
}
statusChannel.Start().then(() => {
statusChannel.GetAllDocuments().then(docs => {
const docsToFetch = []
docs.forEach(rideEntry => {
docsToFetch.push(rideEntry.doc.id)
})
MagicKingdom.GetFacilityNames(docsToFetch).then(() => {
startLiveMonitor()
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment