In my current application, the user can select a download location. This can be updated many times in a single session. Due to being unable to update the path once a handler is registered, I have resorted to calling DownloadManager.register to update the path. The existing code causes multiple handlers to be registered when calling DownloadManager.register multiple times.
This causes the following output from node:
(node:3256) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 browser-window-created listeners added to [App]. Use emitter.setMaxListeners() to increase limit
at _addListener (events.js:390:17)
at App.addListener (events.js:406:10)
...
A more permanent solution would be an API to allow the update of the options parameter, but the module still should not cause this behaviour if used incorrectly. This PR fixes that behaviour.
In my current application, the user can select a download location. This can be updated many times in a single session. Due to being unable to update the path once a handler is registered, I have resorted to calling DownloadManager.register to update the path. The existing code causes multiple handlers to be registered when calling DownloadManager.register multiple times.
This causes the following output from node:
A more permanent solution would be an API to allow the update of the options parameter, but the module still should not cause this behaviour if used incorrectly. This PR fixes that behaviour.