Integrate new minicap along with a moderate rewrite. What's currently missing is recovering from socket death.

This commit is contained in:
Simo Kinnunen
2015-04-15 18:55:46 +09:00
parent 6fe4f8ae1b
commit 95e9dd0b82
43 changed files with 1138 additions and 438 deletions

View File

@@ -0,0 +1,26 @@
function StateQueue() {
this.queue = []
}
StateQueue.prototype.next = function() {
return this.queue.shift()
}
StateQueue.prototype.push = function(state) {
var found = false
// Not super efficient, but this shouldn't be running all the time anyway.
for (var i = 0, l = this.queue.length; i < l; ++i) {
if (this.queue[i] === state) {
this.queue.splice(i + 1)
found = true
break
}
}
if (!found) {
this.queue.push(state)
}
}
module.exports = StateQueue