How to use the ssr-window.window.requestAnimationFrame function in ssr-window

To help you get started, we’ve selected a few ssr-window examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nolimits4web / swiper / src / modules / observer / observer.js View on Github external
const observer = new ObserverFunc((mutations) => {
      // The observerUpdate event should only be triggered
      // once despite the number of mutations.  Additional
      // triggers are redundant and are very costly
      if (mutations.length === 1) {
        swiper.emit('observerUpdate', mutations[0]);
        return;
      }
      const observerUpdate = function observerUpdate() {
        swiper.emit('observerUpdate', mutations[0]);
      };

      if (window.requestAnimationFrame) {
        window.requestAnimationFrame(observerUpdate);
      } else {
        window.setTimeout(observerUpdate, 0);
      }
    });
github framework7io / framework7 / src / core / modules / component / component-class.js View on Github external
$startUpdateQueue() {
    const self = this;
    if (self.__requestAnimationFrameId) return;
    function update() {
      let html = self.$render();

      // Make Dom
      if (html && typeof html === 'string') {
        html = html.trim();
        const newVNode = vdom(html, self, false);
        self.$vnode = patch(self.$vnode, newVNode);
      }
    }
    self.__requestAnimationFrameId = window.requestAnimationFrame(() => {
      if (self.__updateIsPending) update();
      let resolvers = [...self.__updateQueue];
      self.__updateQueue = [];
      self.__updateIsPending = false;
      window.cancelAnimationFrame(self.__requestAnimationFrameId);
      delete self.__requestAnimationFrameId;
      delete self.__updateIsPending;
      resolvers.forEach(resolver => resolver());
      resolvers = [];
    });
  }
github framework7io / framework7 / packages / core / modules / component / component-class.js View on Github external
$update() {
    const self = this;
    window.cancelAnimationFrame(self.__requestAnimationFrameId);
    delete self.__requestAnimationFrameId;
    self.__updateIsPending = true;
    self.__requestAnimationFrameId = window.requestAnimationFrame(() => {
      let html = self.$render();

      // Make Dom
      if (html && typeof html === 'string') {
        html = html.trim();
        const newVNode = vdom(html, self, false);
        self.$vnode = patch(self.$vnode, newVNode);
      }
      self.__updateIsPending = false;
      delete self.__updateIsPending;
    });
  }
github nolimits4web / dom7 / dist / dom7.module.js View on Github external
function requestAnimationFrame(callback) {
  if (window.requestAnimationFrame) return window.requestAnimationFrame(callback);
  else if (window.webkitRequestAnimationFrame) return window.webkitRequestAnimationFrame(callback);
  return window.setTimeout(callback, 1000 / 60);
}
function cancelAnimationFrame(id) {
github nolimits4web / dom7 / dist / dom7.modular.js View on Github external
function requestAnimationFrame(callback) {
  if (window.requestAnimationFrame) return window.requestAnimationFrame(callback);
  else if (window.webkitRequestAnimationFrame) return window.webkitRequestAnimationFrame(callback);
  return window.setTimeout(callback, 1000 / 60);
}
function cancelAnimationFrame(id) {
github framework7io / framework7 / src / core / utils / utils.js View on Github external
requestAnimationFrame(callback) {
    return window.requestAnimationFrame(callback);
  },
  cancelAnimationFrame(id) {
github framework7io / framework7 / packages / core / modules / component / component-class.js View on Github external
$tick(callback) {
    const self = this;
    window.requestAnimationFrame(() => {
      if (self.__updateIsPending) {
        window.requestAnimationFrame(() => {
          callback();
        });
      } else {
        callback();
      }
    });
  }