15 lines
347 B
JavaScript
15 lines
347 B
JavaScript
window.addEventListener("load", () => main());
|
|
|
|
const main = () => {
|
|
// Handle change of focus
|
|
const title = document.title;
|
|
const blurMessage = "Hey.. come back!";
|
|
|
|
window.addEventListener("blur", function () {
|
|
document.title = blurMessage;
|
|
});
|
|
|
|
window.addEventListener("focus", function () {
|
|
document.title = title;
|
|
});
|
|
};
|