Twitchat icon indicating copy to clipboard operation
Twitchat copied to clipboard

PUBLIC_API.md - fixed example code

Open xurei opened this issue 2 years ago • 1 comments

Fixed example code where the connect() function takes arguments but are not set in the call.

Also, removed the setTimeout() in case of connection error, since it won't return anyway.

xurei avatar Jul 29 '22 16:07 xurei

As discussed on discord, i'd prefer to keep the connect params so the function remains context agnostic. But, I indeed forgot to give them on the connect() call, good catch !

Also, i'd prefer to keep the reconnect attempt process so we're sure the app connects to OBS even if OBS is started after. But as you saw, my promise system is broken and should be replaced by something like this:

async function connect(port:string, pass:string):Promise<void> {
	return new Promise((resove, reject)=> {
		try { /*...*/ }
		catch(error) {
			//....
			return;
		}
		//...
		resolve();
	})
}

Thank you for your feedback :) !

Durss avatar Jul 31 '22 17:07 Durss