| 404 | ) |
| 405 | |
| 406 | function notify(event: Payload, isolateListeners: boolean) { |
| 407 | return Effect.gen(function* () { |
| 408 | yield* Effect.forEach( |
| 409 | listeners, |
| 410 | (listener) => (isolateListeners ? observe(event, listener) : listener(event)), |
| 411 | { discard: true }, |
| 412 | ) |
| 413 | const typed = pubsub.typed.get(event.type) |
| 414 | if (typed) yield* PubSub.publish(typed, event) |
| 415 | yield* PubSub.publish(pubsub.all, event) |
| 416 | }) |
| 417 | } |
| 418 | |
| 419 | function publish<D extends Definition>(definition: D, data: Data<D>, options?: PublishOptions) { |
| 420 | return Effect.gen(function* () { |