code: function deregister(type, handler, useCapture) {
      var handlers = listeners[type];
      var index = handlers ? handlers.indexOf(handler) : -1;
  
      if (index > -1) {
        handlers.splice(index, 1);
  
        if (handlers.length === 0) {
          useCapture ? window.removeEventListener(type, globalEventHandler, true) :
              ngWindow.off(type, globalEventHandler);
        }
      }
    }
docs: Removes an event handler from the service.
  @param {string} type Type of event handler.
  @param {!Function} handler The event handler itself.
  @param {boolean} useCapture Whether the event handler used event capturing.