code: function attachListener_() {
      if (isListening) { return; }
      isListening = true;
  
      unsubFunc = Events.eventListener(target, eventName, function() {
        if (outputStream.closed) {
          detachListener_();
        } else {
          Util.apply(boundEmit, arguments);
        }
      });
  
      onClose(outputStream, detachListener_);
    }
docs: Lazily subscribes to a dom event.