This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Custom events in JS
#1
Hello,

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);
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:

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?
Reply


Messages In This Thread
Custom events in JS - by buuuudzik - 29.01.2018, 08:35
RE: Custom events in JS - by admin - 29.01.2018, 08:51
RE: Custom events in JS - by buuuudzik - 29.01.2018, 08:56
RE: Custom events in JS - by admin - 01.02.2018, 13:14
RE: Custom events in JS - by buuuudzik - 01.02.2018, 13:32

Forum Jump: