@laserware/stasis
    Preparing search index...

    Function cps

    • Creates an Effect description that instructs the middleware to invoke fn as a Node style function.

      Type Parameters

      • Fn extends (cb: CpsCallback<any>) => any

      Parameters

      • fn: Fn

        a Node style function. i.e. a function which accepts in addition to its arguments, an additional callback to be invoked by fn when it terminates. The callback accepts two parameters, where the first parameter is used to report errors while the second is used to report successful results

      Returns CpsEffect<ReturnType<Fn>>

    • Creates an Effect description that instructs the middleware to invoke fn as a Node style function.

      Type Parameters

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

      Parameters

      • fn: RequireCpsCallback<Fn>

        a Node style function. i.e. a function which accepts in addition to its arguments, an additional callback to be invoked by fn when it terminates. The callback accepts two parameters, where the first parameter is used to report errors while the second is used to report successful results

      • ...args: CpsFunctionParameters<Fn>

        an array to be passed as arguments for fn

      Returns CpsEffect<ReturnType<Fn>>

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

      Type Parameters

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

      Parameters

      • ctxAndFnName: [Ctx, RequireCpsNamedCallback<Ctx, Name>]
      • ...args: CpsFunctionParameters<Ctx[Name]>

      Returns CpsEffect<ReturnType<Ctx[Name]>>

    • Same as cps([context, fn], ...args) but supports passing context and fn as properties of an object, i.e. yield cps({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[]) => void }
      • Name extends string

      Parameters

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

      Returns CpsEffect<ReturnType<Ctx[Name]>>

    • Same as cps(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[]) => void

      Parameters

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

      Returns CpsEffect<ReturnType<Fn>>

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

      Type Parameters

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

      Parameters

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

      Returns CpsEffect<ReturnType<Fn>>