зеркало из https://github.com/mozilla/pluotsorbet.git
remove unused support for pipe.send w/callback
This commit is contained in:
Родитель
c6a60881bb
Коммит
8a4f465c04
20
libs/pipe.js
20
libs/pipe.js
|
@ -45,11 +45,8 @@ var DumbPipe = {
|
|||
sendQueue: [],
|
||||
isRunningSendQueue: false,
|
||||
|
||||
send: function(envelope, callback) {
|
||||
this.sendQueue.push({
|
||||
envelope: envelope,
|
||||
callback: callback,
|
||||
});
|
||||
send: function(envelope) {
|
||||
this.sendQueue.push(envelope);
|
||||
|
||||
if (!this.isRunningSendQueue) {
|
||||
this.isRunningSendQueue = true;
|
||||
|
@ -58,18 +55,7 @@ var DumbPipe = {
|
|||
},
|
||||
|
||||
runSendQueue: function() {
|
||||
var item = this.sendQueue.shift();
|
||||
|
||||
if (item.callback) {
|
||||
var result = JSON.parse(prompt(JSON.stringify(item.envelope)));
|
||||
try {
|
||||
item.callback(result);
|
||||
} catch(ex) {
|
||||
console.error(ex + "\n" + ex.stack);
|
||||
}
|
||||
} else {
|
||||
alert(JSON.stringify(item.envelope));
|
||||
}
|
||||
alert(JSON.stringify(this.sendQueue.shift()));
|
||||
|
||||
if (this.sendQueue.length > 0) {
|
||||
window.setZeroTimeout(this.runSendQueue.bind(this));
|
||||
|
|
Загрузка…
Ссылка в новой задаче