Making Own Events

·

1 min read

Event() - Basic

We can make our own event using Event() constructor.

We can make the event happen by using 'dispatchEvent()'.

Event() - Options

We can set options such as 'bubbles', 'cancelable' or 'composed'.

In this section, I will cover 'bubbles'.

CustomEvent() - 'detail'

Using CustomEvent() constructor, we can send information using 'detail'.

It is useful when something changes by events and it cannot be accessed by somewhere outside.

|information of other events|

|information in other modules|