You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is related to #3, but enough different that I wanted to fork.
Rather than asking for arbitrary annotations, I think it would be worthwhile to just have a mechanism for explicitly switching script "entry points" -- and let LoAF work as normal beyond that -- but without needing to turn to macrotask scheduling.
For example, perhaps queueMicrotask could be seen as an explicit scheduling call, and could have a distinct Entry Point. That is just a strawman idea.
I just tried a few experiments locally. At a high level, what we would like is for a script to be able to move some continuation into a new "loaf entrypoint", such that loaf can "switch script attribution" to it.
The easiest working example is to just setTimeout(callback, 0) or scheduler.postTask(callback) (provided that callback was actually created by the script you want to change attribution to). But this requires a macrotask hop with FIFO scheduling, which may not be desirable.
I also tried to use scheduler.yield() which has LIFO scheduling, but it did not work as expected:
scheduler.yield().then(callback);
I would have expected that to be a "resolve-promise" entrypoint. I wonder if this is just a bug in LoAF, or expected? (also, while the sourceLocation didn't change scripts, the character offset is 0, so something is funky)
I also tried to find some hacky existing mechanism to switch entry points but stay within the same macrotask. I tried to create EventTarget or <button> and then use addEventListener + dispatchEvent, or various Observers etc, but none of those worked.
The text was updated successfully, but these errors were encountered:
Idea: Perhaps just changing LoAF to treat EventTarget listeners as unique entry-point would be the perfect interface for this use case?
Instead of a library managing its own callback queue and then somehow scheduling those callbacks-- thats already what EventTarget and dispatchEvent does, and there is existing precedent with normal page events already splitting up script attribution on event listener calls.
LoAF script "type" and "name" attribution would also be a lot more useful that way, not just solving the "sourceLocation" problem.
And EventTarget dispatches listeners synchronously, which addresses the concern with just using yield/postTask. If you explicitly want to be asynchronous, you can use explicit scheduling.
As we spoke in a private chat, this wouldn't work in terms of microtask checkpoints. a "real" entry point would call those custom entry points which would add tasks to the microtask queue, and that queue would then be filled with microtasks from different sources without a way to measure them separately. I think #3 is a more doable approach.
This is related to #3, but enough different that I wanted to fork.
Rather than asking for arbitrary annotations, I think it would be worthwhile to just have a mechanism for explicitly switching script "entry points" -- and let LoAF work as normal beyond that -- but without needing to turn to macrotask scheduling.
For example, perhaps
queueMicrotask
could be seen as an explicit scheduling call, and could have a distinct Entry Point. That is just a strawman idea.I just tried a few experiments locally. At a high level, what we would like is for a script to be able to move some continuation into a new "loaf entrypoint", such that loaf can "switch script attribution" to it.
The easiest working example is to just
setTimeout(callback, 0)
orscheduler.postTask(callback)
(provided thatcallback
was actually created by the script you want to change attribution to). But this requires a macrotask hop with FIFO scheduling, which may not be desirable.I also tried to use scheduler.yield() which has LIFO scheduling, but it did not work as expected:
I would have expected that to be a "resolve-promise" entrypoint. I wonder if this is just a bug in LoAF, or expected? (also, while the sourceLocation didn't change scripts, the character offset is 0, so something is funky)
I also tried to find some hacky existing mechanism to switch entry points but stay within the same macrotask. I tried to create
EventTarget
or<button>
and then useaddEventListener
+dispatchEvent
, or various Observers etc, but none of those worked.The text was updated successfully, but these errors were encountered: