Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created November 24, 2015 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/c618b3bfbfe1521a179e to your computer and use it in GitHub Desktop.
Save mattpodwysocki/c618b3bfbfe1521a179e to your computer and use it in GitHub Desktop.
function fromEvent(target, fn) {
return Observable.create(o => {
const handler = e => o.onNext(e);
target.addEventListener(fn, false);
return () => target.removeEventListener(fn, false);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment