[Sugar-devel] [sugar-html-core] Some questions regarding the bus.js API.
Aneesh Dogra
lionaneesh at gmail.com
Fri May 17 21:32:20 EDT 2013
Hello list,
I was just looking over some code in bus.js and I noticed that we are
actually using a stack to prioritize and keep track of our send requests.
The array which you name as "queue" is actually used as a stack.
Here's what I think is happening:
Suppose I send 3 consecutive requests:
The script adds them in the "queue" variable as: [1, 2, 3]
but in start we are doing:
while (queue.length > 0) {
socket.send(queue.pop());
}
so, we send the requests in order:
3, 2, 1
Hence, the last request made later gets the first priority.
Is this intended by design?
--
Thanks
Aneesh Dogra (lionaneesh)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130518/75d2eacf/attachment.html>
More information about the Sugar-devel
mailing list