Merge pull request #59 from xsorifc28/patch-1

sendControl causing "uncaught in promise" error
This commit is contained in:
Rob Moran
2021-02-28 10:10:22 +00:00
committed by GitHub

View File

@@ -306,10 +306,12 @@ export class SecureDfu extends EventDispatcher {
}
private sendControl(operation: Array<number>, buffer?: ArrayBuffer): Promise<DataView> {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
this.sendOperation(this.controlChar, operation, buffer)
.then(resp => {
setTimeout(() => resolve(resp), this.delay);
}).catch(err => {
reject(err);
});
});
}