OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-store / store / stats / flow / start-app.js

39 lines · javascript ref:
import {
  all as t,
  call as i,
  setContext as o,
  getContext as e,
  select as r,
} from "redux-saga/effects"
import { ENV_CONTEXT_KEY as m } from "../../constants"
import { initApplication as n, getAppState as a } from "../../app"
import { getIsIdentityConfirmed as s } from "../../identity"
import {
  TIME_CONTEXT_KEY as l,
  sequence as d,
  printFlow as p,
  createTimeContext as c,
  parallel as f,
  step as y,
} from "./flow.model"
import { statsStartMainRoomSaga as T } from "./start-mainRoom"
import { statsRenderRoomListSaga as u } from "./start-roomList"
export function* statsAppInitialLoad({ startTime: g, startDoneTime: x }) {
  const { timeStats: S } = yield e(m),
    { log: A } = S || {},
    D = "start app"
  ;(A(`[STATS] "${D}": collecting initial load stats... `), yield o({ [l]: c(x) }))
  const L = yield y(n, { startTime: g, doneTime: x })
  if (!(yield r(s))) return void p(d(D, [L]))
  const R = x,
    { linkData: k } = yield r(a)
  if (k) {
    const [o, e] = yield t([i(T, { nextRoom: !0 }, { currentTime: R }), i(u, { currentTime: R })]),
      r = d(D, [L, f([o, e])])
    yield p(r)
  }
  const v = yield i(u, { currentTime: R }),
    w = d(D, [L, v])
  yield p(w)
}