mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 22:20:06 +02:00
19 lines
267 B
JavaScript
19 lines
267 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const Throat = require('throat');
|
||
|
|
||
|
module.exports = (() => {
|
||
|
const _queues = {};
|
||
|
|
||
|
// pushToQueue
|
||
|
return (id, cb) => {
|
||
|
if (_queues[id]) {
|
||
|
_queues[id](cb);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
_queues[id] = Throat(1);
|
||
|
_queues[id](cb);
|
||
|
};
|
||
|
})();
|