code: function withPromise(callback, {raf = false} = {}) {
    return new Promise((resolve, reject) => {
      if (raf) {
        requestAnimationFrame(() => {
          callback(resolve, reject);
        });
      } else {
        callback(resolve, reject);
      }
    });
  }
docs: Wraps functions in promise with potential animation frame option
  @param {Function} callback
  @param {Object} options
  @param {Boolean} options.raf
  @return {Promise}
  @private