Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Created October 16, 2019 07:35
Show Gist options
  • Save Sawtaytoes/4d492dbcc1eaad26b1615a4c6dc722c5 to your computer and use it in GitHub Desktop.
Save Sawtaytoes/4d492dbcc1eaad26b1615a4c6dc722c5 to your computer and use it in GitHub Desktop.
const pingEpic = (
action$,
) => (
action$
.pipe(
ofType(CREATE_PING_LISTENER)
mergeMap(({
namespace,
}) => (
action$
.pipe(
ofType(PING),
ofNamespace(namespace),
takeUntil(
action$
.pipe(
ofType(STOP_PING_LISTENER)
)
),
switchMap(() => (
timer(1000)
)),
mapTo({ namespace }),
map(pong),
)),
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment