I'm encountering a TypeError: undefined is not an object (evaluating 'window.TAURI_EVENT_PLUGIN_INTERNALS.unregisterListener') when calling port.close() (or port.cancelListen()) after a listener has been set up with port.listen().
If port.close() is called before port.listen(), the error does not occur.
This bug appears to cause serial port listeners to accumulate, leading to multiple receive callbacks for a single incoming message after repeated connect/disconnect cycles.
Environment:
Tauri API: @tauri-apps/api: ^2.5.0
Plugin: tauri-plugin-serialplugin: ^2.12.0
Issue: The plugin's internal listener unregistration seems to fail, resulting in accumulated listeners and an unhandled TypeError during port closure when a listener is active.
Please investigate this issue.