function createQueuethefrontside/effection
function createQueue<T, TClose>(): Queue<T, TClose>
Creates a new queue. Queues are unlimited in size and sending a message to a queue is always synchronous.
Examples
Example 1
import { each, main, createQueue } from 'effection';
await main(function*() {
let queue = createQueue<number>();
queue.send(1);
queue.send(2);
queue.send(3);
let next = yield* queue.subscription.next();
while (!next.done) {
console.log("got number", next.value);
next = yield* queue.subscription.next();
}
});
Type Parameters
T the type of the items in the queue
TClose the type of the value that the queue is closed with
Return Type
Queue<T, TClose>