Hello all,
I use prototype library for several years and like it very much.
The question is about Function#defer. I used it in my work but never
looked under the hood.
The description says: "A “deferred” function will not run immediately;
rather, it will run as soon as the interpreter’s call stack is empty."
I looked at the Function#defer code, and there was nothing about
stack. All that defer do is delaying function run for 0.01 second. And
there is nothing about such behaviour in the docs.
According to docs, such code:
function a1(text) {
console.log(text);
}
a1.defer(1);
a1(2);
Should produce '1' and then '2'. In real live it will produce '2' and
then '1'.
I think API docs should be updated to help developers better
understand what defer really do.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.