How to use the ember-in-viewport/utils/can-use-raf function in ember-in-viewport

To help you get started, we’ve selected a few ember-in-viewport 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 DockYard / ember-in-viewport / addon / services / in-viewport.js View on Github external
init() {
    super.init(...arguments);


    set(this, 'registry', new WeakMap());

    let options = assign({
      viewportUseRAF: canUseRAF()
    }, this._buildOptions());

    // set viewportUseIntersectionObserver after merging users config to avoid errors in browsers that lack support (https://github.com/DockYard/ember-in-viewport/issues/146)
    options = assign(options, {
      viewportUseIntersectionObserver: canUseIntersectionObserver(),
    });

    setProperties(this, options);
  }
github DockYard / ember-in-viewport / addon / mixins / in-viewport.js View on Github external
init() {
    // ensure this mixin runs first, then your component can override the options
    this._super(...arguments);

    let options = assign({
      viewportUseRAF: canUseRAF(),
      viewportEntered: false,
      viewportListeners: []
    }, this._buildOptions());

    // set viewportUseIntersectionObserver after merging users config to avoid errors in browsers that lack support (https://github.com/DockYard/ember-in-viewport/issues/146)
    options = assign(options, {
      viewportUseIntersectionObserver: canUseIntersectionObserver(),
    });

    setProperties(this, options);
    set(this, '_evtListenerClosures', []);
  },