Sawtaytoes
9/30/2018 - 5:10 AM

Immediate Execution in Redux-Observable

Immediately logging the app version when Redux-Observable starts.

// Redux-Observable 1.x.x
const logAppVersionEpic = () => (
  of(appVersion)
  .pipe(
    tap(console.info),
    ignoreElements(),
  )
)

// Another Option for Redux-Observable 1.x.x
const logAppVersionEpic = () => (
  EMPTY
  .pipe(
    defaultIfEmpty(appVersion),
    tap(console.info),
    ignoreElements(),
  )
)

// Redux-Observable 0.x.x
const logAppVersionEpic = () => (
  timer(0)
  .pipe(
    mapTo(appVersion),
    tap(console.info),
    ignoreElements(),
  )
)