OK, so I have more information on the situation that makes when-dom
eat CPU. I don’t think it’s specific to my application. I believe it happens when using Hoplon jquery. In jquery.cljs
, there’s a default on!
handler that attaches the callback. But I believe I have a situation where items are added to the DOM and then taken out (into the tpl cache, I believe) before the event loop starts properly. So the condition inside when-dom is never satisfied, or is not satisfied until much later, and CPU chompage results.
What’s weird is that I can rewrite when-dom
to give up after a while and my app still works just fine…
oooh
good sleuthing
@candera are you using standard tpl implementation or your custom one?
Both, and I haven’t tracked down which one it is.
hopefully not mine 😉
if it's me i apologise
No, I’m not using yours yet.
I have started to move mine in that direction, though.
you'll need latest hoplon to use mine, the updates to merge-kids are needed
Yeah, that’s why I haven’t moved.
soz, it is simpler though
Right, and I took some of your good ideas. 🙂
So, there’s an interesting technique where you can use CSS animations to get notified of an element being added to the DOM:
http://www.backalleycoder.com/2012/04/25/i-want-a-damnodeinserted/
I might wind up trying that. Will let you know how it goes.