Skip to content

Instantly share code, notes, and snippets.

@JBreit
Created June 5, 2017 22:59
Show Gist options
  • Save JBreit/a6424e3c34cac745d88e30e64af43fa3 to your computer and use it in GitHub Desktop.
Save JBreit/a6424e3c34cac745d88e30e64af43fa3 to your computer and use it in GitHub Desktop.
/* global document Rx*/
const link = document.querySelector('.nav-link');
const link$ = Rx.Observable.fromEvent(link, 'click');
const observer = {
next(event) {
console.log(event);
},
error(err) {
console.error(err);
},
complete() {
document.createElement('p').innerHTML = JSON.stringify(event.target.value);
}
};
link$.subscribe(observer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment