'Document title won't stop blicking

I'm trying to get the document title to blink whenever there's an incoming message. I was able to get the title to blink properly, however the problem I'm running into is that it won't stop. Ideally, the blinking will stop when the mouse is moved but I'm not sure why my onmousemove handler won't work properly. The browser I'm using this on is IE 11.

function titleAlert(message) { 
      var alertId, oldTitle = document.title;
      alertId = setInterval(function(){
           document.title = document.title == message ? oldTitle : message;
      }, 1500);
            
      var clear = function() {
          clearInterval(alertId);
          document.title = oldTitle;
          oldTitle = alertId = null;
      };
            
      return function() {   
           //also tried document.onmousemove
           window.onmousemove = clear;
      };
}  


Solution 1:[1]

you just returned a definition of a function but not run it.

    return (function() {   
       //also tried document.onmousemove
       window.onmousemove = clear;
    })();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elheni Mokhles