windowClose event not triggered
ziyouchutuwenwu opened this issue Β· comments
ziyouchutuwenwu commented
Describe the bug
windowClose event not triggered
To Reproduce
Steps to reproduce the behavior:
- install neu cli
npm install -g @neutralinojs/neu
- create project
neu create demo --template neutralinojs/neutralinojs-zero
- code
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello Neutralinojs</title>
<style>
body {
background-color: white;
}
</style>
</head>
<body>
It works π
<script src="neutralino.js"></script>
<script>
Neutralino.init();
Neutralino.events.on("ready", () => {
Neutralino.os.showMessageBox("ready", "on ready");
});
Neutralino.events.on("windowClose", () => {
Neutralino.os.showMessageBox("close", "will close");
});
</script>
</body>
</html>
neutralino.config.json
{
"applicationId": "js.neutralino.zero",
"version": "1.0.0",
"defaultMode": "window",
"documentRoot": "/www/",
"url": "/",
"enableServer": true,
"enableNativeAPI": true,
"nativeAllowList": [
"app.*",
"os.*"
],
"modes": {
"window": {
"title": "demo",
"width": 800,
"height": 500,
"minWidth": 400,
"minHeight": 200,
"icon": "/www/icon.png"
}
},
"cli": {
"binaryName": "demo",
"resourcesPath": "/www/",
"extensionsPath": "/extensions/",
"clientLibrary": "/www/neutralino.js",
"binaryVersion": "5.1.0",
"clientVersion": "5.1.0"
}
}
Expected behavior
both ready and windowClose event will be called
Screenshots/Screen recordings
https://github.com/neutralinojs/neutralinojs/assets/7458713/7deb2053-bd68-43c8-b343-8e61f1766330
Specifications
- OS: manjaro linux
$ neofetch
ββββββββββββββββββ ββββββββ mmc@manjaro
ββββββββββββββββββ ββββββββ -----------
ββββββββββββββββββ ββββββββ OS: Manjaro Linux x86_64
ββββββββββββββββββ ββββββββ Host: HP ProDesk 480 G6 MT
ββββββββ ββββββββ Kernel: 6.6.25-1-MANJARO
ββββββββ ββββββββ ββββββββ Uptime: 17 hours, 20 mins
ββββββββ ββββββββ ββββββββ Packages: 1339 (pacman)
ββββββββ ββββββββ ββββββββ Shell: zsh 5.9
ββββββββ ββββββββ ββββββββ Resolution: 1920x1080
ββββββββ ββββββββ ββββββββ DE: Xfce 4.18
ββββββββ ββββββββ ββββββββ WM: Xfwm4
ββββββββ ββββββββ ββββββββ WM Theme: JacWin10
ββββββββ ββββββββ ββββββββ Theme: Windows10 [GTK2/3]
ββββββββ ββββββββ ββββββββ Icons: Faenza [GTK2/3]
Terminal: terminator
CPU: Intel i5-9500 (6) @ 4.400GHz
GPU: Intel CoffeeLake-S GT2 [UHD Graphics 630]
Memory: 6296MiB / 31941MiB
- Neutralinojs version: 5.1.0
- Neutralinojs client library version: 5.1.0
- Neutralinojs CLI version: [e.g. v9.1.2]
$ neu version
_ _ _ _ _ _
| \ | | ___ _ _| |_ _ __ __ _| (_)_ __ ___ (_)___
| \| |/ _ \ | | | __| '__/ _` | | | '_ \ / _ \| / __|
| |\ | __/ |_| | |_| | | (_| | | | | | | (_) | \__ \
|_| \_|\___|\__,_|\__|_| \__,_|_|_|_| |_|\___// |___/
|__/
--- Global ---
neu CLI: v11.0.1
neu: INFO Run this command inside your project directory to get project specific Neutralinojs version.
Aniket Kumar commented
Try replacing "windowClose" with "beforeClose" in your code and see if it works as expected.
ziyouchutuwenwu commented
hi, not working, html code like this
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello Neutralinojs</title>
<style>
body {
background-color: white;
}
</style>
</head>
<body>
It works π
<script src="neutralino.js"></script>
<script>
Neutralino.init();
Neutralino.events.on("ready", () => {
Neutralino.os.showMessageBox("ready", "on ready");
});
Neutralino.events.on("beforeClose", () => {
Neutralino.os.showMessageBox("close", "will close");
});
</script>
</body>
</html>
neu run
ready msgbox popuped, nothing happened when i click close button