21 lines
336 B
JavaScript
21 lines
336 B
JavaScript
|
function StatusHandler() {
|
||
|
var baseTitle = document.title;
|
||
|
window.addEventListener('focus', reset);
|
||
|
|
||
|
return {
|
||
|
reset: reset,
|
||
|
set: set
|
||
|
};
|
||
|
|
||
|
function reset() {
|
||
|
document.title = baseTitle;
|
||
|
}
|
||
|
|
||
|
function set(newStatus) {
|
||
|
if(!document.hasFocus()) {
|
||
|
document.title = newStatus + " - " + baseTitle;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|