@laserware/stasis
    Preparing search index...

    Function take

    • Creates an Effect description that instructs the middleware to wait for a specified action on the Store. The Generator is suspended until an action that matches pattern is dispatched.

      The result of yield take(pattern) is an action object being dispatched.

      pattern is interpreted using the following rules:

      • If take is called with no arguments or '*' all dispatched actions are matched (e.g. take() will match all actions)

      • If it is a function, the action is matched if pattern(action) is true (e.g. take(action => action.entities) will match all actions having a (truthy) entities field.)

      Note: if the pattern function has toString defined on it, action.type will be tested against pattern.toString() instead. This is useful if you're using an action creator library like redux-act or redux-actions.

      • If it is a String, the action is matched if action.type === pattern (e.g. take(INCREMENT_ASYNC)

      • If it is an array, each item in the array is matched with aforementioned rules, so the mixed array of strings and function predicates is supported. The most common use case is an array of strings though, so that action.type is matched against all items in the array (e.g. take([INCREMENT, DECREMENT]) and that would match either actions of type INCREMENT or DECREMENT).

      The middleware provides a special action END. If you dispatch the END action, then all Sagas blocked on a take Effect will be terminated regardless of the specified pattern. If the terminated Saga has still some forked tasks which are still running, it will wait for all the child tasks to terminate before terminating the Task.

      Parameters

      • Optionalpattern: ActionPattern

      Returns TakeEffect

    • Creates an Effect description that instructs the middleware to wait for a specified action on the Store. The Generator is suspended until an action that matches pattern is dispatched.

      The result of yield take(pattern) is an action object being dispatched.

      pattern is interpreted using the following rules:

      • If take is called with no arguments or '*' all dispatched actions are matched (e.g. take() will match all actions)

      • If it is a function, the action is matched if pattern(action) is true (e.g. take(action => action.entities) will match all actions having a (truthy) entities field.)

      Note: if the pattern function has toString defined on it, action.type will be tested against pattern.toString() instead. This is useful if you're using an action creator library like redux-act or redux-actions.

      • If it is a String, the action is matched if action.type === pattern (e.g. take(INCREMENT_ASYNC)

      • If it is an array, each item in the array is matched with aforementioned rules, so the mixed array of strings and function predicates is supported. The most common use case is an array of strings though, so that action.type is matched against all items in the array (e.g. take([INCREMENT, DECREMENT]) and that would match either actions of type INCREMENT or DECREMENT).

      The middleware provides a special action END. If you dispatch the END action, then all Sagas blocked on a take Effect will be terminated regardless of the specified pattern. If the terminated Saga has still some forked tasks which are still running, it will wait for all the child tasks to terminate before terminating the Task.

      Type Parameters

      • A extends Action

      Parameters

      • Optionalpattern: ActionPattern<A>

      Returns TakeEffect

    • Creates an Effect description that instructs the middleware to wait for a specified message from the provided Channel. If the channel is already closed, then the Generator will immediately terminate following the same process described above for take(pattern).

      Type Parameters

      • T

      Parameters

      • channel: TakeableChannel<T>
      • OptionalmulticastPattern: Pattern<T>

      Returns ChannelTakeEffect<T>