code: function register(type, handler, useCapture) {
      var handlers = listeners[type] = listeners[type] || [];
  
      if (!handlers.length) {
        useCapture ? window.addEventListener(type, globalEventHandler, true) :
            ngWindow.on(type, globalEventHandler);
      }
  
      if (handlers.indexOf(handler) === -1) {
        handlers.push(handler);
      }
    }
docs: Registers a new handler with the service.
  @param {string} type Type of event to be registered.
  @param {!Function} handler Event handler.
  @param {boolean} useCapture Whether to use event capturing.