Created
September 10, 2018 19:38
-
-
Save jonbcampos/6be8e2634a1db7ea62ac971b7f5c042f to your computer and use it in GitHub Desktop.
This file contains 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
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