How to use just-throttle - 3 common examples

To help you get started, we’ve selected a few just-throttle 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 desko27 / smash-tier-list / src / containers / SmashTierList.jsx View on Github external
});

    // root url should fallback to 'currentGame'
    if (route === '/') history.push(`/${currentGame.route}`);

    // go to it for the first time only if game actually exists
    if (gamesData.find(g => g.route === getCleanRoute(route))) {
      goToRequestedGame(route);
    }

    // save the current redux state for ssr
    this.firstReduxState = store.getState();

    // make throttled methods
    const SCROLL_TRIGGER_THRESHOLD = 10; // ms
    this._throttledHandleScroll = throttle(this._handleScroll, SCROLL_TRIGGER_THRESHOLD, true);
  }
github deepsweet / hocs / packages / throttle-handler / src / index.js View on Github external
constructor (props, context) {
      super(props, context)

      const intervalValue = typeof interval === 'function' ? interval(props) : interval

      this.throttlePropInvoke = throttle(
        (...args) => this.props[handlerName](...args),
        intervalValue,
        leadingCall
      )

      this.handler = (e, ...rest) => {
        if (e && typeof e.persist === 'function') {
          e.persist()
        }

        return this.throttlePropInvoke(e, ...rest)
      }
    }
github imyelo / pokequest-wiki / src / pages / PokemonList.vue View on Github external
delete query[key]
        } else if (typeof patch[key] === 'boolean' && patch[key] === false) {
          delete query[key]
        }
      }
      if (this.hasFilters) {
        this.$router.replace({
          query,
        })
      } else {
        this.$router.push({
          query,
        })
      }
    },
    handleScroll: throttle(function ({ target }) {
      this.scrollTop = {
        last: this.scrollTop.current,
        current: target.scrollTop,
      }
    }, 200),
    scrollToTop () {
      this.$refs.main.scrollTop()
    },
  },
  components: {
    TypeCapsule,
    Iconfont,
  },
}

just-throttle

return a throttled function

MIT
Latest version published 2 years ago

Package Health Score

64 / 100
Full package analysis

Popular just-throttle functions