From 9cb1d10d4d8b26fee2d901a29c73ae0ebfac73fc Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 15 Nov 2021 21:02:28 -0800 Subject: [PATCH 1/2] Allow customizing initialize timeout --- src/serial.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/serial.ts b/src/serial.ts index d365edb..c59c1cf 100644 --- a/src/serial.ts +++ b/src/serial.ts @@ -44,9 +44,9 @@ export class ImprovSerial extends EventTarget { /** * Detect Improv Serial, fetch the state and return the next URL if provisioned. - * @returns + * @param timeout Timeout in ms to wait for the device to respond. Default to 1000ms. */ - public async initialize(): Promise { + public async initialize(timeout = 1000): Promise { this.logger.log("Initializing Improv Serial"); this._processInput(); // To give the input processing time to start. @@ -58,7 +58,7 @@ export class ImprovSerial extends EventTarget { await new Promise(async (resolve, reject) => { setTimeout( () => reject(new Error("Improv Wi-Fi Serial not detected")), - 1000 + timeout ); await this.requestCurrentState(); resolve(undefined); From de519d06757c40f5e3b7d691d385d0848b7add2b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 15 Nov 2021 21:02:47 -0800 Subject: [PATCH 2/2] 2.1.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index db08a03..9fed55c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "improv-wifi-serial-sdk", - "version": "2.0.0", + "version": "2.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "improv-wifi-serial-sdk", - "version": "2.0.0", + "version": "2.1.0", "license": "Apache-2.0", "dependencies": { "@material/mwc-button": "^0.25.3", diff --git a/package.json b/package.json index e2a0808..c567a1f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "improv-wifi-serial-sdk", - "version": "2.0.0", + "version": "2.1.0", "description": "Improv Wi-Fi Serial SDK for the browser", "main": "dist/serial-launch-button.js", "repository": "https://github.com/improv-wifi/sdk-serial-js",