Created
September 5, 2019 12:16
-
-
Save juristr/365fda00df3f708c7ec09a9ba1eebd1d to your computer and use it in GitHub Desktop.
rxjs toolbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://twitter.com/niklas_wortmann/status/1167361268732370944 | |
const observeOnMutation = (target, config): Observable<MutationRecord[]> => { | |
return new Observable((observer) => { | |
const mutation = new MutationObserver((mutaitons, instance) => { | |
observer.next(mutations); | |
}); | |
mutation.observe(target, config); | |
const teardown = () => { | |
mutation.disconnect(); | |
}; | |
return teardown; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment