Code: Select all
var self = this;
try {
var connected = false;
while (connected == false) {
await this.instance.connect()
.then(function () {
connected = true;
}, async function (err) {
var thisErr = `${err}`;
await self.dotNetReference.invokeMethodAsync("OnError", thisErr);
await new Promise(r => setTimeout(r, 5000));
});
}
} catch (ex) {
var thisErr = `${ex}`;
await self.dotNetReference.invokeMethodAsync("OnError", thisErr);
}
Code: Select all
var self = this;
try {
var connected = false;
while (connected == false) {
await this.instance.open(phidget22.Phidget.DEFAULT_TIMEOUT)
.then(function () {
connected = true;
}, async function (err) {
var thisErr = `${err}`;
await self.dotNetReference.invokeMethodAsync("OnError", thisErr);
await new Promise(r => setTimeout(r, 5000));
});
}
} catch (ex) {
var thisErr = `${ex}`;
await self.dotNetReference.invokeMethodAsync("OnError", thisErr);
}