ws4kp/server/scripts/modules/status.mjs

36 lines
707 B
JavaScript
Raw Normal View History

2022-11-22 22:19:10 +00:00
const STATUS = {
loading: Symbol('loading'),
loaded: Symbol('loaded'),
failed: Symbol('failed'),
noData: Symbol('noData'),
disabled: Symbol('disabled'),
2022-12-12 19:53:33 +00:00
retrying: Symbol('retyring'),
2022-11-22 22:19:10 +00:00
};
const calcStatusClass = (statusCode) => {
switch (statusCode) {
case STATUS.loading:
return 'loading';
case STATUS.loaded:
return 'press-here';
case STATUS.failed:
return 'failed';
case STATUS.noData:
return 'no-data';
case STATUS.disabled:
return 'disabled';
case STATUS.retrying:
return 'retrying';
default:
return '';
}
};
const statusClasses = ['loading', 'press-here', 'failed', 'no-data', 'disabled', 'retrying'];
2022-11-22 22:19:10 +00:00
export default STATUS;
export {
calcStatusClass,
statusClasses,
};