Created
February 20, 2019 15:57
-
-
Save ipcrm/e74cb51e43437848de2e0b4083591552 to your computer and use it in GitHub Desktop.
polling
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
// Starting polling | |
const result = new Deferred<string>(); | |
const timer = setInterval(async () => { | |
... | |
const deploymentStatus = await httpClient.exchange<any>(`${someurl}/${somepath}`, { | |
method: HttpMethod.Get, | |
headers: { | |
Accept: "application/json", | |
}, | |
}); | |
... | |
if (somecondition) { | |
result.resolve(somevalue); | |
} | |
}, pollInternal); | |
// Wait for polling to finish | |
const status = await result.promise; | |
clearInterval(timer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment