Polymer: Please add Throttle utility

Created on 7 Mar 2017  路  11Comments  路  Source: Polymer/polymer

Most helpful comment

You can use lodash-cli to create custom builds which can be damn small if you pick just the methods you need :)

All 11 comments

It would be very useful, once debounce is available throttle is a must-have.

can be very useful for certain use-case!

We've trimmed the core library to be much leaner, and we are unlikely to add more utility API such as this which is better distributed via general purpose utility libraries.

However we encourage developers to create class mixins (using standard ES6 class expressions) and/or simply implement the utility API they desire on a subclass of Polymer.Element and use that as the base class for elements developed in your organization.

@kevinpschaaf @sorvell @azakus Please create Throttle utility. We need throttle for resize and click events. Thank you.

@kevinpschaaf @sorvell @azakus Could you create project Polymer Sugar with modular utilities, mixins for Polymer Elements 2.0?

Why don't you just use lodash? Polymer shouldn't even provide debounce method, IMHO.

@merlinnot We need throttle mixin for Polymer Elements from Polymer JS Experts... We need maintained mixins from Polymer Team.

lodash.min.js has 71KB... How to load only throttle function in Polymer element?

@JosefJezek it is extremely easy to write your own throttle function and put it in a behavior for reuse. If you've never done it before, I suggest is as a good exercise to understand behaviors. You can also write your own base class that extends Polymer.Element and includes all the helper functions you want.

However, I suggest staying away from asynchronous behaviors as much as possible.

You can use lodash-cli to create custom builds which can be damn small if you pick just the methods you need :)

Here is utility for Polymer https://github.com/StartPolymer/s-utils

Was this page helpful?
0 / 5 - 0 ratings