29 lines
1 KiB
JavaScript
29 lines
1 KiB
JavaScript
/** globals nextCleanupParsedTime:false WELCOME_WAGON_DEPART_TIMES:false */
|
|
var WWRESET_INTERVAL_VERSION = '1.0';
|
|
print('wwResetInterval version ' + WWRESET_INTERVAL_VERSION);
|
|
print('TimeText = ' + nextCleanupParsedTime.timeText);
|
|
print('DepartTimes = ' + JSON.stringify(WELCOME_WAGON_DEPART_TIMES));
|
|
var welcomeWagonArriving = (WELCOME_WAGON_DEPART_TIMES.indexOf(nextCleanupParsedTime.timeText) !== -1);
|
|
|
|
if (!welcomeWagonArriving) {
|
|
print('Welcome wagon arrive check.');
|
|
} else {
|
|
print('Welcome wagon depart check.');
|
|
}
|
|
|
|
var WELCOME_WAGON_CHANNEL = 'com.highfidelity.welcomeWagon';
|
|
|
|
var STOP_CHECKING_WHEN = {
|
|
NEVER: 0,
|
|
WELCOME_WAGON_ARRIVES: 1,
|
|
WELCOME_WAGON_LEAVES: 2
|
|
};
|
|
|
|
Messages.sendMessage(WELCOME_WAGON_CHANNEL, JSON.stringify({
|
|
action: 'check',
|
|
forceReset: false,
|
|
maxIntervalRuns: 90,
|
|
directCheck: true,
|
|
interval: 1000,
|
|
stopCheckingWhen: !welcomeWagonArriving ? STOP_CHECKING_WHEN.WELCOME_WAGON_ARRIVES : STOP_CHECKING_WHEN.WELCOME_WAGON_LEAVES
|
|
}));
|