How to use the @redux-saga/core/effects.delay function in @redux-saga/core

To help you get started, we’ve selected a few @redux-saga/core 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 Jameskmonger / creature-chess / src / shared / board / sagas / evolution.ts View on Github external
function*(action) {
                    const piece = action.payload.piece;

                    // if evolution is locked, wait for it to be unlocked
                    if (sagaState.evolutionLocked) {
                        yield take(UNLOCK_EVOLUTIONS);
                        yield delay(500);
                    }

                    const { bench, board }: TState = yield select(s => ({ bench: s.bench, board: s.board }));

                    const { stages } = definitionProvider.get(piece.definitionId);

                    const nextStageIndex = piece.stage + 1;
                    const nextStage = stages[nextStageIndex];

                    if (!nextStage) {
                        return;
                    }

                    const pieceIsMatching = (p: Piece) => p.definitionId === piece.definitionId && p.stage === piece.stage;
                    const getMatchingPieces = (pieces: Piece[]) => pieces.filter(p => p.id !== piece.id && pieceIsMatching(p));
github Jameskmonger / creature-chess / src / app / sagas / actions / notifications.ts View on Github external
yield takeLatest(BANNER_UPDATED, function*() {
        yield delay(1000);

        yield put(bannerUpdatedAction(null));
    });
};