shivanshuag / dart-throttle-debounce

Dart port of jquery throttle/debounce
MIT License
3 stars 1 forks source link

Current API not a great fit with code completion or static analysis #1

Open sethladd opened 9 years ago

sethladd commented 9 years ago

Thanks for sharing!

Have you checked out https://github.com/JosephMoniz/dart-throttle ? There might be a generic way to throttle stream events.

The current API of:

element.on('someevent')...

Is prone to misspellings and isn't a great fit for code completion. I wonder if there's a more Dart way to design this API?

For example, I wonder if you could build a StreamController that knew how to throttle. That way, you don't have to built the on(something API... just work with the Stream API.

shivanshuag commented 9 years ago

Hi, Correct me if I misunderstood you. I'm sorry, I put the wrong brackets here. The someevent here can be any generic event. It should have been element.on['keyup'] or any other event. I will update the README and remove someevents because it is confusing.

I wanted to keep it like the jquery version, so I did not use event Streams.

Thanks for taking interest in it.