I read a lot of responses and blog posts on the jQuery queues ... and it is this particular answer was very helpful - qaru.site/questions/17208 / ... . But, like the standard docs on jquery.com, the answer above made me take a look at the jquery code http://code.jquery.com/jquery-1.7.2.js
What I can’t understand - from the code - is how the "fx" queue starts automatically (by default). Especially after emptying the line.
For example, in a user queue, when you manually start a queue and there are not enough functions to call in the queue, any link to the queue is no longer valid, so I expect somewhere in the jquery code I’ll try to understand from the state of the queue, and if it was empty autostart it? The kinda code demonstrates what I came across, if I just miss a piece of code (I look at the line: 2060-2160 in the above code), please let me know.
> var aq = $({});
> aq.queue("mp").length
0
> n1 = aq.queue("mp")
[]
> n1.length
0
> aq.queue("mp", function (next) { setTimeout(next, 5000); })
[Object]
> aq.queue("mp", function (next) { setTimeout(next, 5000); })
[Object]
> aq.queue("mp", function (next) { setTimeout(next, 5000); })
[Object]
> n1.length
0
> aq.queue("mp").length
3
> n1 = aq.queue("mp");
> n1.length
3
Also, if any part of this is unclear, let me know and I will update it accordingly.
source
share