Skip to content

Instantly share code, notes, and snippets.

@jonbcampos
Created September 10, 2018 19:38
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 jonbcampos/6be8e2634a1db7ea62ac971b7f5c042f to your computer and use it in GitHub Desktop.
Save jonbcampos/6be8e2634a1db7ea62ac971b7f5c042f to your computer and use it in GitHub Desktop.
function waitingRule(options: any): Rule {
return (host: Tree) => {
const observer = new Observable<Tree>((observer) => {
fetch('someUrl.com/') // any async operation
.then(res => res.json())
.then(data => {
observer.next(host);
observer.complete();
})
.catch(function (err: any) {
observer.error(err);
});
});
return observer;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment