Fix for loading the wasm in the context of a webview tag (electron)

Issue #40 new
qashto created an issue

When loading em-fceux in a webview tag (electron) ENVIRONMENT_IS_WEB is true. The wasm fails to be loaded because while you define readAsync you aren’t using it. I’ve implemented it in the getBinary function for you. Please lmk when you update em-feux on npm with this fix! 🙂

            async function getBinary() {
                try {
                    if (wasmBinary) {
                        return new Uint8Array(wasmBinary)
                    }
                    if (readBinary) {
                        return readBinary(wasmBinaryFile)
                    } else if (readAsync) {
                        return new Promise((resolve, reject) => {
                            readAsync(wasmBinaryFile, (data) => {
                                resolve(data)
                            }, () => {
                                throw "async fetching of the wasm failed"
                                reject()
                            });
                        });
                    } else {
                        throw "both async and sync fetching of the wasm failed"
                    }
                } catch (err) {
                    abort(err)
                }
            }