Davidobot / love.js

LÖVE ported to the web using Emscripten, updated to the latest Emscripten and LÖVE (v11.5)
MIT License
605 stars 27 forks source link

love.event.quit() causes crash but doesn't close tab #70

Open FormularSumo opened 1 year ago

FormularSumo commented 1 year ago

Calling love.event.quit() or love.event.quit("restart") causes love.js to crash. Ideally it should close the tab similar to how native love2d closes the game window.

Davidobot commented 1 year ago

You're free to call JS' window.close(); via the JS player

FormularSumo commented 1 year ago

Is there a way it doing that from within love2d? I feel like it'd make the most sense for love.event.quit() to call the window.close; function but I'm not sure how hard that would be to do.

Davidobot commented 1 year ago

See https://github.com/Davidobot/love.js/issues/26

FormularSumo commented 1 year ago

Got that working but window.close(); only works if the current tab was opened via the same script (eg using window.open();), so I guess there isn't really a way for love.js to implment the love.event.quite function properly

ChicknTurtle commented 5 months ago

This works for me on Opera GX, but not on Chrome:

window.open('', '_self', '');
window.close();