Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const logoutTime = 15* 60;
const warningTime = 14 * 60;
function createLogoutActionStream() {
return Observable.merge(
Observable.of({ type: 'showLogoutMessageWarning' }).delay(warningTime * 1000),
Observable.of({ type: 'logOut' }).delay(logoutTIme * 1000)
.startWith(null) // ensure starts at app boot instead of first mouse event
.flatMapLatest(createLogoutActionStream) // flatMapLatest will start timeout and reset with each new event
.doOnNext(dispatch); // dispatch actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.