Open
Description
Currently, you can only pass one value through your custom_args_js_event
event without some creative coding.
The current event trigger could be modified to pass an object as an argument. This object will be passed by reference, and any hook will be able to modify it and set e.g. args.category = 123;
.
The current implementation is:
// Check for custom args
var custom_args_js_event = $el.data( 'customArgsJsEvent' );
var custom_data = '';
if ( 'undefined' !== typeof custom_args_js_event && null !== custom_args_js_event ) {
var custom_result = $el.triggerHandler( custom_args_js_event );
if ( 'undefined' !== typeof custom_result && null !== custom_result ) {
custom_data = custom_result;
}
}
A better implementation would be:
// Check for custom args
var custom_args_js_event = $el.data( 'customArgsJsEvent' );
var custom_data = {};
if ( 'undefined' !== typeof custom_args_js_event && null !== custom_args_js_event ) {
$el.triggerHandler( custom_args_js_event, custom_data );
}
We need to be concerned with backwards compatibility here, and maybe check the result and if the result is undefined, then look to the object.