-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
theDialogManager addHandler no arguments passed to handler function #2843
Comments
This is not a very efficient nor maintainable solution to manage dialog open/close event handlers in today's perspective. I'm thinking about defining custom events for dialog opening and closing events, and register/deregister event handlers for them. This was inspired by Bootstrap's |
You could use the standard event system available: element.on / trigger
Which would make sense since this ships natively with the browser/jq. see https://api.jquery.com/category/events/event-handler-attachment/ and https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events |
Yep, that's what I'm talking about. I just haven't got time to bring that thoight into reality yet. Still struggling with cleaning up code of the s-table class. |
Alrighty then, also these 'nice-to-have' events for reference: // ruTorrent component overrides
plugin.flmConfig = theWebUI.config;
theWebUI.config = (data) => $(document).trigger('theWebUI:config', [data]) && plugin.flmConfig.call(theWebUI, data);
$(document).on('theWebUI:config', () => plugin.canChangeTabs() && plugin.ui.setConfig());
plugin.flmOnShow = theTabs.onShow;
theTabs.onShow = (id) => $(document).trigger('theTabs:onShow', [id]) && plugin.flmOnShow.call(theTabs, id);
plugin.flmTabsShow = theTabs.show;
theTabs.show = (id) => {
$(document).trigger('theTabs:show', [id]);
plugin.flmTabsShow.call(theTabs, id);
};
plugin.addAndShowSettings = theWebUI.addAndShowSettings;
theWebUI.addAndShowSettings = (data) => $(document).trigger('theWebUI:addAndShowSettings', [data]) &&
plugin.addAndShowSettings.call(theWebUI, data);
plugin.flmSetSettings = theWebUI.setSettings;
theWebUI.setSettings = (data) => $(document).trigger('theWebUI:setSettings', [data]) &&
plugin.flmSetSettings.call(theWebUI, data);
plugin.createTorrentFileMenu = theWebUI.createFileMenu;
theWebUI.createFileMenu = (e, data) => (plugin.createTorrentFileMenu.call(theWebUI, e, data) &&
$(document).trigger('theWebUI:createFileMenu', [data, e])); |
Please complete the following tasks.
Tell us about your environment
Docker
Tell us how you installed ruTorrent
Docker
Describe the bug
The handler and the previous queued function are being called with no arguments in addHandler method:
ruTorrent/js/objects.js
Line 251 in 25679a4
The proper function handler signature is this (when called):
ruTorrent/js/objects.js
Line 236 in 25679a4
Steps to reproduce
Check if handler function has any arg value when multiple handler are registered for the same event.
Expected behavior
Use something like this
Additional context
Noticed while working with the _getDir plugin on the hide events
The text was updated successfully, but these errors were encountered: