title: How do I clear all intervals?
body: <p>I am using </p>
  
  <pre><code>varName = setInterval(function() { ... }, 1000);
  </code></pre>
  
  <p>to set a couple of intervals in a jquery plugin that I'm writing, but when the plugin is reloaded I need to clear those intervals. I tried storing them in variables, like this:</p>
  
  <pre><code>(function($){
  $.mosaicSlider = function(el) {
      var base = this;        
      var transitionInterval, mainInterval;
  
  ...
  
  base.init = function() {
      mainInterval = setInverval(function() { ... }, 1000);
  }
  
  base.grid = function() {
      this.transition() = function() {
           transitionInterval = setInterval(function(...) {
      }
  }
  
  base.init();
  </code></pre>
  
  <p>And I tried killing those intervals in the base.init() function, like this:</p>
  
  <pre><code>clearInterval(transitionInterval);
  clearInterval(mainInterval);
  </code></pre>
  
  <p>And like this: </p>
  
  <pre><code>window.oldSetInterval = window.setInterval;
  window.setInterval = new function(func, interval) {  }
  </code></pre>