Skip to content

Instantly share code, notes, and snippets.

@dance2die
Last active October 18, 2019 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/236f83b3e9777089f51fdb88bee0a1a9 to your computer and use it in GitHub Desktop.
Save dance2die/236f83b3e9777089f51fdb88bee0a1a9 to your computer and use it in GitHub Desktop.
export const pingEpic = action$ =>
action$.pipe(
ofType(PING),
// 1️⃣ from "delay(1000)" to 👇
switchMap(() => timer(1000)),
mapTo(pong()),
tap(console.info)
);
// 2️⃣ pongEpic stays the same.
export const pongEpic = action$ =>
action$.pipe(
ofType(PONG),
delay(1000),
mapTo(ping()),
tap(console.info)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment