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);
});
async function getData() {
try {
const { files } = await request.get(
"https://api.github.com/gists/992b79b40cea84ff7ca8efb8cc2350ee",
{
headers: {
"User-Agent": "React-Finland",
},
json: true,
}
);
return {
schedules: JSON.parse(files["schedule.json"].content),
speakers: JSON.parse(files["speakers.json"].content),
};
} catch (err) {
console.error(err);
}
return {};
}
GitlabLdapGroupSync.prototype.startScheduler = function (interval) {
this.stopScheduler();
ins = every(interval).do(this.sync);
}