29.01.2018, 08:35
Hello,
I want to create some custom events in JS. I've found such solution:
https://www.sitepoint.com/javascript-custom-events/
But to do this I must connect event to some nearly dummy selector but I know that currently there are such events:
which not need any HTML selector. How to do something similar, e.g. generate event when plan changed for whole scripts?
I want to create some custom events in JS. I've found such solution:
Code:
var event = new CustomEvent(
"newMessage",
{
detail: {
message: "Hello World!",
time: new Date(),
},
bubbles: true,
cancelable: true
}
);
document.getElementById("msgbox").dispatchEvent(event);
But to do this I must connect event to some nearly dummy selector but I know that currently there are such events:
Code:
.. grp.listen('6/0/54', function(obj, type) { ...
which not need any HTML selector. How to do something similar, e.g. generate event when plan changed for whole scripts?