code: function callWhenIdle(scheduler, fn) {
    if (!scheduler.once || !scheduler.isIdle || scheduler.isIdle()) {
      fn();
    } else {
      scheduler.once(idleEventName, function() { fn(); });
    }
  }
docs: Calls a function once the scheduler is idle.  If the scheduler does not support the idle API,
  calls the function immediately.  See scheduler.md#idle-api for details.
  
  @param {Object} scheduler The scheduler to wait for.
  @param {!Function} fn The function to call.