title: angular2 zone event getting triggered after js events
body: <p>I have integrated angular2 into existing project that primarily uses JS/Jquery. Existing JS code binds events such as "mousemove", "mousedown", etc. such that every time user clicks or moves anywhere in the page an event is triggered &amp; timer is reset as well as callback function is called (psuedo code below)</p>
  
  <pre><code>body.bind("mousemove keydown mousewheel mousedown", function () {           
              if (timer) { 
                  clearTimeout(timer); //reset timer function
              }
  
              // Set a new timer.
              timer = setTimeout(some_callback_function, 5000)
          })
  </code></pre>
  
  <p>Issue is every time any event is triggered below angular2 zone function is also triggered  (For full code refer url => <a href="https://unpkg.com/zone.js@0.7.4" rel="nofollow noreferrer">https://unpkg.com/zone.js@0.7.4</a>). Is there any way to skip angular2 zone function &amp; events problematically? In other words is there any way we can invoke angular2 zone function manually as &amp; when required.</p>
  
  <pre><code>function ZoneTask(type, zone, source, callback, options, scheduleFn, cancelFn) {
              this.runCount = 0;
              this.type = type;
              this.zone = zone;
              this.source = source;
              this.data = options;
              this.scheduleFn = scheduleFn;
              this.cancelFn = cancelFn;
              this.callback = callback;
              var self = this;
              this.invoke = function () {
                  _numberOfNestedTaskFrames++;
                  try {
                      return zone.runTask(self, this, arguments);
                  }
                  finally {
                      if (_numberOfNestedTaskFrames == 1) {
                          drainMicroTaskQueue();
                      }
                      _numberOfNestedTaskFrames--;
                  }
              };
          }
  </code></pre>
  
  <p>PS:- From stack trace I can see binding is done in 'patchTimer' function in same 'zone.js' file that executes line <code>var task = zone.scheduleMacroTask(setName, args[0], options, scheduleTask, clearTask);</code> and calls <code>function ZoneTask</code></p>