Browse Source

fix(core): check if listener.handler is undefined (#10007)

Yasunari Fujieda 1 year ago
parent
commit
4ca297b35b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/tauri/src/event/mod.rs

+ 1 - 1
core/tauri/src/event/mod.rs

@@ -231,7 +231,7 @@ pub fn event_initialization_script(function: &str, listeners: &str) -> String {
         const listeners = (window['{listeners}'] && window['{listeners}'][eventData.event]) || []
         for (const id of ids) {{
           const listener = listeners[id]
-          if (listener) {{
+          if (listener && listener.handler) {{
             eventData.id = id
             listener.handler(eventData)
           }}