Durss / Twitchat

Full featured Twitch chat alternative to fill gaps from the official one.
https://twitchat.fr
GNU General Public License v3.0
269 stars 30 forks source link

PUBLIC_API.md - fixed example code #17

Open xurei opened 2 years ago

xurei commented 2 years ago

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.

Durss commented 2 years ago

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 :) !