How to use the effector.launch function in effector

To help you get started, we’ve selected a few effector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zerobias / effector / src / effector / fork.js View on Github external
],
    parent: effects,
  })
  const onEnd = createNode({
    node: [
      step.run({
        fn() {
          fxCount -= 1
          completeInitPhase()
        },
      }),
    ],
    parent: finalizers,
  })
  if (start) {
    launch(find(start), ctx)
  }
  isSyncComplete = true
  completeInitPhase()
  return defer.req
}
function flatGraph(unit) {
github zerobias / effector / src / effector / fork.js View on Github external
function universalLaunch(unit, payload) {
  if (stack.length > 0) {
    invoke(unit, payload)
  } else {
    launch(unit, payload)
  }
}
export function fork(domain, {values = {}} = {}) {
github zerobias / effector / src / effector / fork.js View on Github external
export function invoke(unit, payload) {
  if (stack.length === 0) {
    throw Error('invoke cannot be called outside of forked .watch')
  }
  launch(stack[stack.length - 1](unit), payload)
}
github zerobias / effector / src / react / ssr.js View on Github external
? params => {
      const req = new Defer()
      launch(unit, {params, req})
      return req.req
    }
    : payload => {
github zerobias / effector / src / effector / fork.js View on Github external
return payload => {
    launch(result, payload)
  }
}
github zerobias / effector / src / react / ssr.js View on Github external
: payload => {
      launch(unit, payload)
      return payload
    }
  return React.useCallback(result, [scope, event])