code: function (callback, element) {
          if (requestAnimationFramePromise) {
            requestAnimationFramePromise.then(callback);
            return;
          }
  
          requestAnimationFramePromise = new Promise(function (resolve) {
            if (!element) {
              element = document.body;
            }
  
            requestAnimationFrame(resolve, element);
          }).then(callback);
        }
docs: Requests an animation frame and fallbacks to a timeout on older browsers.
  
  @method requestAnimationFrame
  @param {function} callback Callback to execute when a new frame is available.
  @param {DOMElement} element Optional element to scope it to.