Created
May 14, 2019 00:14
-
-
Save DougSisk/42e2367807fc49aac627c2f53e14a396 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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