@foxiko/client
Advanced tools
Comparing version 1.0.19 to 1.0.20
@@ -289,2 +289,3 @@ const {APIEntity} = require("../../APIEntity"); | ||
/** | ||
* Executes a command | ||
* | ||
@@ -322,2 +323,24 @@ * @param type {String|ContainerCommand} | ||
/** | ||
* Awaits until the container is an certain status, this is useful to check if the container is started after sending a command | ||
* | ||
* @param statuses {string[]|string} Statuses to check for | ||
* @param delay {int} delay in ms to check | ||
* @return {Promise<Container>} | ||
*/ | ||
async awaitStatus(statuses, delay = 1000) { | ||
if(!Array.isArray(statuses)) { | ||
statuses = [statuses]; | ||
} | ||
return new Promise( resolve => { | ||
let interval = setInterval(async () => { | ||
let r = await this.#handler.get(this.id); | ||
if(r.status && statuses.includes(r.status.status)) { | ||
clearInterval(interval); | ||
return resolve(r); | ||
} | ||
}, delay); | ||
}); | ||
} | ||
} | ||
@@ -324,0 +347,0 @@ |
{ | ||
"name": "@foxiko/client", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"description": "", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@foxiko/oauth": "^1.0.10", | ||
"@foxiko/oauth": "^1.0.11", | ||
"foxiko-oauth": "^1.0.7", | ||
@@ -15,0 +15,0 @@ "foxiko-request-handler": "^0.1.1", |
118713
1786
Updated@foxiko/oauth@^1.0.11