5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 03:01:45 +08:00
* update function notifyListeners in events.js

newEventListenerList will delete wrong listener if it call splice method in for-loop.

* Update events.js

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
Hao 2023-02-25 09:58:59 +08:00 committed by GitHub
parent dcfd525dd1
commit 0212698714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,7 +97,7 @@ function notifyListeners(eventData) {
const newEventListenerList = eventListeners[eventName].slice();
// Iterate listeners
for (let count = 0; count < eventListeners[eventName].length; count += 1) {
for (let count = eventListeners[eventName].length - 1; count >= 0; count -= 1) {
// Get next listener
const listener = eventListeners[eventName][count];