How To Make Your Own JavaScript Events

preview_player
Показать описание
JavaScript has tons of different events that you can listen to, but you can also create your own custom event for any use case you can think of. Best of all it is incredibly easy to create a custom event in JavaScript. These events are great for implementing things like touch based gestures, and even communicating across your application.

📚 Materials/References:

🌎 Find Me Here:

⏱️ Timestamps:

00:00 - Introduction
00:40 - Basic Custom Events
02:43 - Custom Event Options
05:51 - Passing Data To Custom Events
06:48 - Double Click Example

#CustomJSEvents #WDS #JavaScript
Рекомендации по теме
Комментарии
Автор

Been watching you for years now. You're such a good instructor, I attribute a lot of my knowledge to you, thank you so much!

christopherholt
Автор

Thanks for speaking clearly, as an Indonesian which i dont speak native english, your video is really helpful, thank you

andianwar
Автор

For the use cases I would add a situation when you want to integrate React UI and a game engine. Using custom events you can make the game engine and React UI communicate and share data between each other.

kakakakaka
Автор

Will there be a follow-up video about using events in Node, js?

c__beck
Автор

I’ve been doing web dev for years and just learned about custom events. Thank you for sharing 💪

ZacharyBetz
Автор

Using custom events in conjunction with web components is the cream of the top!

LePhenixGD
Автор

dude your content is always just awesome, I can't wait to use this in a project

infinitepurelive
Автор

Nice video 👍 I like that you cover subjects like this (rare subjects). Others have videos that are mostly same and similar with other youtubers.

ugljesavojvodic
Автор

U are legit the best JS youtuber ever, keep doing your content because u are just the definition of perfect !

astec
Автор

I don't know where you work but they are lucky to have you.

duran_codes
Автор

You should make a tutorial on how you keep your hair looking so good!

smtp_yurzx
Автор

Do a follow-up video on how to do this with typescript's types please

sriramiyer
Автор

when would a composed event be more useful than a postMessage api call?

Marcosmapf
Автор

Hard to read, text is too small (whereas there's a lot of empty room in the screen)... :-(

stoncjoesperanto
Автор

Weldone boss, pls can you make a video on how to set isTrusted=true

Primadex
Автор

I used this in conjunction with a Promise; I had the Promise resolve when my custom event was generated.

Mickey_McD
Автор

Waiting for how to make your own JavaScript

TheScriptingLegend
Автор

Please do some explanation on shadow DOM!

stoneshou
Автор

Nice one - thanks. But I wonder about the use case. I think you mentioned decoupling different parts of an app which makes sense.
But wouldn't a simple PUB/SUB mechanism (essentially a MAP where the key is the event "name" and the value is an array of handlers) be more efficient?

montebont
Автор

Sir, How to detect closed tab browser by javascript event? not reload ( i want to do something when user try to closed tab or exist browser directly without logout my web application ). thanks 🙏

yoskokleng