OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-store / store / room / room-version.saga.js

26 lines · javascript ref:
import { call as o, put as r, select as e, take as i } from "redux-saga/effects"
import { isFeatureSupported as m } from "@holepunchto/keet-core/features"
import { getCoreBackend as t } from "../../backend"
import { apiSubscribeSaga as n } from "../lib"
import { taskErrorSaga as s } from "../error"
import { setRoomVersion as f } from "./room.action"
import { getRoomVersion as c } from "./room.selector"
import { parseRoomVersionResponse as p } from "./room.model"
export function* subscribeRoomVersion({ roomId: o, appVersion: e }) {
  const i = t(),
    m = p(o, e)
  yield n([i.subscribeRoomVersion, o], (o) => r(f(m(o))), {
    onError: (o) => s("subscribeRoomVersion", o),
  })
}
export function roomVersionGate(r, t, n = [], s = m) {
  return function* (m) {
    for (;;) {
      const o = yield e(c(m))
      if (s(o, r)) break
      yield i(f)
    }
    yield o(t, ...n)
  }
}