Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof(Number.prototype.toRad) === 'undefined') {
Number.prototype.toRad = function() {
return this * (Math.PI / 180);
}
}
// Prime the station list on startup and read periodically
loadStationList();
every('24h').do(function() {
loadStationList();
});
// Prime the elevator status on startup and read periodically
loadElevatorStatus();
every('15m').do(function() {
loadElevatorStatus();
});
app.use(cors());
app.use('/', router);
app.listen(port);
console.log('BART API Server listening on port ' + port);
router.route(apiContext + '/elevatorStatus').get(
function(request, response) {
response.jsonp(infoCache.getElevatorStatus());
}
);
if (typeof(Number.prototype.toRad) === 'undefined') {
Number.prototype.toRad = function() {
return this * (Math.PI / 180);
}
}
// Prime the station list on startup and read periodically
loadStationList();
every('24h').do(function() {
loadStationList();
});
// Prime the elevator status on startup and read periodically
loadElevatorStatus();
every('15m').do(function() {
loadElevatorStatus();
});
app.use(cors());
app.use('/', router);
app.listen(port);
console.log('BART API Server listening on port ' + port);
});
}).on('error', function() {
console.log("[error] Get data error!");
message = {
'stat': 'fail',
'msg': 'Get data error!'
}
res.send(200, message);
return false;
});
});
/**
* 启动定时任务
*/
every(config.emailTimes).do(function() {
getMessageModule(url);
});
}
//获取到数据 source,我们可以对数据进行操作了!
res.on('end', function() {
//console.log(source);
var $ = cheerio.load(source);
var currentData = $("center").html();
sentMailModule(currentData);
});
}).on('error', function() {
console.log("获取数据出现错误");
});
}
/**
* 启动定时任务
*/
every('2s').do(function() {
getMessageModule(url);
});
GitlabLdapGroupSync.prototype.startScheduler = function (interval) {
this.stopScheduler();
ins = every(interval).do(this.sync);
}