Running Effects in a Normal Callback
Hey guys, quick question, how can I run effects in normal callbacks? Example
import { something } from 'alibrary';
const program = Effect.gen(function* (_) {
const queue = yield* _(Queue.bounded<number>(3));
something.startListening((someNumber) => {
/**
* Would like to add item in the queue
* the line bellow seems to be working, but not sure if there's a better way
*/
Effect.runPromise(queue.offer(someNumber));
})
while (true) {
const item = yield* _(Queue.take(queue));
// do something
}
})
...