@laserware/stasis
    Preparing search index...

    Function spawn

    • Same as fork(fn, ...args) but creates a detached task. A detached task remains independent from its parent and acts like a top-level task. The parent will not wait for detached tasks to terminate before returning and all events which may affect the parent or the detached task are completely independents (error, cancellation).

      Type Parameters

      • Fn extends (...args: any[]) => any

      Parameters

      • fn: Fn
      • ...args: Parameters<Fn>

      Returns ForkEffect<SagaReturnType<Fn>>

    • Same as spawn([context, fn], ...args) but supports passing a fn as string. Useful for invoking object's methods, i.e. yield spawn([localStorage, 'getItem'], 'redux-saga')

      Type Parameters

      • Ctx extends { [P in string]: (this: Ctx, ...args: any[]) => any }
      • Name extends string

      Parameters

      Returns ForkEffect<SagaReturnType<Ctx[Name]>>

    • Same as spawn([context, fn], ...args) but supports passing context and fn as properties of an object, i.e. yield spawn({context: localStorage, fn: localStorage.getItem}, 'redux-saga'). fn can be a string or a function.

      Type Parameters

      • Ctx extends { [P in string]: (this: Ctx, ...args: any[]) => any }
      • Name extends string

      Parameters

      • ctxAndFnName: { context: Ctx; fn: Name }
      • ...args: Parameters<Ctx[Name]>

      Returns ForkEffect<SagaReturnType<Ctx[Name]>>

    • Same as spawn(fn, ...args) but supports passing a this context to fn. This is useful to invoke object methods.

      Type Parameters

      • Ctx
      • Fn extends (this: Ctx, ...args: any[]) => any

      Parameters

      • ctxAndFn: [Ctx, Fn]
      • ...args: Parameters<Fn>

      Returns ForkEffect<SagaReturnType<Fn>>

    • Same as spawn([context, fn], ...args) but supports passing context and fn as properties of an object, i.e. yield spawn({context: localStorage, fn: localStorage.getItem}, 'redux-saga'). fn can be a string or a function.

      Type Parameters

      • Ctx
      • Fn extends (this: Ctx, ...args: any[]) => any

      Parameters

      • ctxAndFn: { context: Ctx; fn: Fn }
      • ...args: Parameters<Fn>

      Returns ForkEffect<SagaReturnType<Fn>>