title: Kyle Simpson asyncify function from You Don't Know JS: Async & Performance
body: <p>If someone can explain in detail what this function does?
  What is this part doing:  fn = orig_fn.bind.apply(orig_fn,  </p>
  
  <p>Thanks. </p>
  
  <pre><code>function asyncify(fn) {
          var orig_fn = fn,
              intv = setTimeout( function(){
                  intv = null;
                  if (fn) fn();
              }, 0 )
          ;
  
          fn = null;
  
          return function() {
              // firing too quickly, before `intv` timer has fired to
              // indicate async turn has passed?
              if (intv) {
                  fn = orig_fn.bind.apply(
                      orig_fn,
                      // add the wrapper's `this` to the `bind(..)`
                      // call parameters, as well as currying any
                      // passed in parameters
                      [this].concat( [].slice.call( arguments ) )
                  );
              }
              // already async
              else {
                  // invoke original function
                  orig_fn.apply( this, arguments );
              }
          };
      }
  </code></pre>