choojs / nanocomponent

🚃 - create performant HTML components
https://leaflet.choo.io/
MIT License
366 stars 30 forks source link

remove RAF wrappers around unload/load #59

Closed lrlna closed 7 years ago

lrlna commented 7 years ago

This is based off of #58, but removes all of the RAF wrappers.

For further context, here is an IRC snippet from earlier today:

<toddself> bret: yeah i mean RAF isn't "ordered" like setTimeout is
6:59 PM <bret> if you spam the hell out of RAF, does it automatically run then at 60fps as long as a particular RAF doesn't go beyond the 12ms or whatever?
6:59 PM <toddself> i.e. if you you cotinously call setTimeout, all those timeouts will expire in the order in which you call them (if they're all set to the same time)
6:59 PM <bret> lrlna: I can try to get something out tonight, but if you want you can try removing those RAFs and npm link
6:59 PM <toddself> RAF is going to batch all the calls but i don't think it's going to do anything with regards to timing
7:00 PM <bret> toddself: ah wow ok
7:00 PM toddself: there is some weirdness with removing them, I think. on-load error or something with out them but I didn't look into why and just kept them
7:01 PM <toddself> bret: i'm not 100% positive on this but itseems like it isn't doing it in order of RAF calls
7:01 PM bret: or there's stuff with mutation observers
7:01 PM bret: and how they interact
7:02 PM 

Basically the issue we've been facing is around the fact that RAF is preventing component rendering in sync: i.e. we need to run function after a component has been loaded and nothing else can happen before hand". And removing this check allows for ordered events.

Thanks ^___^

toddself commented 7 years ago

So this fixes the underlying issue we were having. Should we merge and pub a patch with a new PR to make this better? Or should we wait until we have a better solution?

toddself commented 7 years ago

:package: 6.4.2