2021-07-16 16:51:28 +00:00
|
|
|
// Common JS cannot be used in frontend sadly
|
|
|
|
// sleep, ucfirst is duplicated in ../src/util-frontend.js
|
2021-07-01 13:47:14 +00:00
|
|
|
|
2021-07-24 03:42:14 +00:00
|
|
|
exports.DOWN = 0;
|
|
|
|
exports.UP = 1;
|
|
|
|
exports.PENDING = 2;
|
|
|
|
|
2021-07-15 17:44:51 +00:00
|
|
|
exports.sleep = function (ms) {
|
2021-06-25 13:55:49 +00:00
|
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
|
|
}
|
2021-06-29 08:06:20 +00:00
|
|
|
|
2021-07-15 17:44:51 +00:00
|
|
|
exports.ucfirst = function (str) {
|
2021-07-09 06:14:03 +00:00
|
|
|
if (! str) {
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2021-06-29 08:06:20 +00:00
|
|
|
const firstLetter = str.substr(0, 1);
|
|
|
|
return firstLetter.toUpperCase() + str.substr(1);
|
|
|
|
}
|
2021-06-30 18:02:54 +00:00
|
|
|
|
2021-07-23 04:58:05 +00:00
|
|
|
exports.debug = (msg) => {
|
|
|
|
if (process.env.NODE_ENV === "development") {
|
|
|
|
console.log(msg)
|
|
|
|
}
|
|
|
|
}
|