Skip to content

Instantly share code, notes, and snippets.

@cartant
Last active March 13, 2018 03:31
Show Gist options
  • Select an option

  • Save cartant/3acfee8bf0c0f9cc0e5e40e14b02f606 to your computer and use it in GitHub Desktop.

Select an option

Save cartant/3acfee8bf0c0f9cc0e5e40e14b02f606 to your computer and use it in GitHub Desktop.
const findAddresses = actions$ => actions$.pipe(
ofType(actions.FIND_ADDRESSES),
map(action => action.partialAddress),
debounceTime(400),
distinctUntilChanged(),
switchMap(partialAddress => this.backend
.findAddresses(partialAddress)
.pipe(
map(results => actions.findAddressesFulfilled(results)),
catchError(error => of(actions.findAddressesRejected(error)))
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment