2021-07-16 19:51:28 +03:00
|
|
|
// Common JS cannot be used in frontend sadly
|
|
|
|
// sleep, ucfirst is duplicated in ../src/util-frontend.js
|
2021-07-01 16:47:14 +03:00
|
|
|
|
2021-07-24 06:42:14 +03:00
|
|
|
exports.DOWN = 0;
|
|
|
|
exports.UP = 1;
|
|
|
|
exports.PENDING = 2;
|
|
|
|
|
2021-07-15 20:44:51 +03:00
|
|
|
exports.sleep = function (ms) {
|
2021-06-25 16:55:49 +03:00
|
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
|
|
}
|
2021-06-29 11:06:20 +03:00
|
|
|
|
2021-07-15 20:44:51 +03:00
|
|
|
exports.ucfirst = function (str) {
|
2021-07-09 09:14:03 +03:00
|
|
|
if (! str) {
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2021-06-29 11:06:20 +03:00
|
|
|
const firstLetter = str.substr(0, 1);
|
|
|
|
return firstLetter.toUpperCase() + str.substr(1);
|
|
|
|
}
|
2021-06-30 21:02:54 +03:00
|
|
|
|