bug: Cannot read properties of null (reading 'drawingBufferWidth') when using KaPlay in NW.js
Bug Description
The error TypeError: Cannot read properties of null (reading 'drawingBufferWidth') is thrown when using KAPLAY (and Kaboom) in NW.js.
The error is thrown at initGfx (gfx.ts:562:15) & at KAPLAY (kaboom.ts:444:17). This error was not being thrown with original Kaboom prior to Kaboom's depreciation. After Kaboom's depreciation, both Kaboom and KAPLAY throw this error. My original code has not changed a bit.
Version
Latest from CDN
To Reproduce
Steps to reproduce the behavior:
- Create a normal NW.js setup.
- Write out your main HTML file as follows:
<html>
<head>
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<script type="module">
function checkInternetConnection() {
fetch('https://www.google.com', { mode: 'no-cors' })
.then(response => {
if (!response.ok && response.type !== 'opaque') {
window.location.href = 'offline.html';
// plain offline HTML file does render
}
})
.catch(error => {
window.location.href = 'offline.html';
console.error('Error checking internet connection:', error);
});
}
checkInternetConnection();
import kaplay from "https://unpkg.com/[email protected]/dist/kaboom.mjs";
// does import correctly. just throws error during initialization of rendering
kaplay();
</script>
</body>
</html>
- Drag package.json on top of nw.exe to run the app, or use a batch file to it for you, like me.
Expected behavior
KAPLAY not erroring out and actually working...
Screenshots
is this only NW.JS or does it throw in Electron Tauri and Web
is this only NW.JS or does it throw in Electron Tauri and Web
Haven't tried in Electron cause in my opinion it's a RAM hog and not suitable for my project. The others I haven't even thought of or used yet. The HTML file runs fine when opened in regular Google Chrome.
Can you try with the master version? npm i github:marklovers/kaplay
Can you try with the master version? npm i
github:marklovers/kaplay
I'll try once I get out of bed today.
Out of bed but will be a little bit delayed. Computer just crashed because Chrome and the other processes I was running decided to take up more RAM than the computer could take. I really need to get myself a better PC
I see, no problem hh. We released recently alpha 18, if you can try it, cool. If not I will when I got time
Closing for now, maybe a build problem? Please reopen if any other advances