doesn't send arguments


How are arguments sent?‘CustomEvent’, (aArgs) => {
// aArgs is undefined
return true;
});‘CustomEvent’, { a: 1, b: 2, c: 3 });


The fire() function takes an array for the arguments."CustomEvent",[{a:1,b:2,c:3}]);

This assumes your function is taking the object and extracting the elements. If you want to just send multiple arguments without using the object, you can do it like this:"CustomEvent",(arg1, arg2, arg3) => {
    // do something with arg1, arg 2, and arg3
    return true;

I updated your snippet with a function that handles both methods so you can see the differences in how the fire() function is called:


Thank you.

And how can I check existing event?
I found only['customevent'] != undefined


I don’t think there’s a documented way to check for the existence of an event. Your way would work, although I might suggest changing it to check that it’s a function just to be extra careful that it’s not somehow set to some other data type:

typeof['customevent'] === "function"


I agree with You. It was a temporary solution