love.js icon indicating copy to clipboard operation
love.js copied to clipboard

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

Open FormularSumo opened this issue 3 years ago • 5 comments

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.

FormularSumo avatar Oct 05 '22 18:10 FormularSumo

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

Davidobot avatar Oct 05 '22 21:10 Davidobot

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.

FormularSumo avatar Oct 05 '22 21:10 FormularSumo

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

Davidobot avatar Oct 05 '22 21:10 Davidobot

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

FormularSumo avatar Oct 09 '22 15:10 FormularSumo

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

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

ChicknTurtle avatar Apr 05 '24 01:04 ChicknTurtle