@tabatkins @jyasskin Strawman idea: addEventWorklet(), which allows you to register an OMT event handler that can access proxy DOM elements…
-
-
…and a requestAnimationFrameWorklet(). e.g.: window.aEW(‘scroll’, [theElement], (event, theElement) => {http://theElement.style.top = …}).
1 reply 0 retweets 0 likes -
Minimal difference from the existing Web platform. Easy to retrofit existing content. Targeted fix for OMT event handlers/animation frames.
1 reply 0 retweets 0 likes -
But here’s what gives me pause about the whole idea: Once you have off main thread layout, all you’re solving is main thread jank.
1 reply 0 retweets 0 likes -
What causes main thread jank? Slow frameworks (e.g. ones that do vDOM diffing) and bad adtech (oversimplified, but you get the idea).
1 reply 0 retweets 0 likes -
So I wish we could just do like native does and figure out how to free up the main thread instead of piling up workarounds.
1 reply 0 retweets 1 like -
Ultimately, that means moving the DOM itself OMT, so only core program logic is in main. That's a big change!
2 replies 0 retweets 0 likes -
Replying to @tabatkins @jyasskin
Not sure I follow…Take Core Animation as exemplar of native (https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/CoreAnimationBasics/CoreAnimationBasics.html …): model layer is main thread…
1 reply 0 retweets 0 likes -
…while presentation tree is manipulated off main thread. Web-of-my-dreams: DOM is main thread model, render tree is OMT presentation layer.
1 reply 0 retweets 0 likes
(Though I think the model layers can also be manipulated OMT, which argues in favor of having some kind of event worklet.)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.