Skip to content

Instantly share code, notes, and snippets.

@dufia
dufia / toasterSaga.ts
Created February 16, 2020 17:02
Toaster saga
import { HIDE_TOAST, SHOW_TOAST, updateToasts } from '../actions';
import { all, delay, fork, put, take, takeEvery } from 'redux-saga/effects';
function* toasterSaga() {
const MaxToasts = 3;
const ToastDisplayTime = 5000;
const ToastAnimationTime = 500;
const toastTimers: number[] = []; // keep track of when toasts are added
const pendingToasts: any[] = [];