wilsonpage / fastdom

Eliminates layout thrashing by batching DOM measurement and mutation tasks
6.83k stars 240 forks source link

fastdom.throttle #71

Closed glebmachine closed 8 years ago

glebmachine commented 8 years ago

Have an idea, to implement throttling feature in fastdom (already use same in my projects) It will be returns handler, which calls only once per raf (with last arguments), on read cycle.

If you ok, i will implement this method and tests in new PR, just let me know)

Also, we can have first parameter, which set number of frames to throttle

wilsonpage commented 8 years ago

IIUC this is a bit out of scope. I want to keep the library as simple as possible. I am looking into ways that users can extend fastdom to add new features. This will likely be part of a v1 release.

var fastdomThrottled = fastdom.extend(myThrottleExtension);

fasdomThrottled.read(...);
fasdomThrottled.write(...);
glebmachine commented 8 years ago

Yeah, it's good idea to have some extends, which kept out of basic build.

How you with to organise file structure? It should be out or repo, or just extension folder with extensions per file? I want create first one)