Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
System events are cool
-
0:00
In JavaScript programming, you can use code block functions to handle events.
-
0:05
There are two types of events that can occur.
-
0:08
A user event or a system event.
-
0:11
An example of a user event is a mouse click.
-
0:14
When a mouse click happens on the button, the callback is triggered and
-
0:18
then an alert is shown.
-
0:20
An example of a system event is the setTimeout function.
-
0:24
A call back gets executed after a given time.
-
0:27
The developer may define the time when the call back gets executed, but
-
0:32
the system is what triggers it.
-
0:34
Another example of a system event is the ready state change of an Ajax request.
-
0:40
[SOUND] The ready state change handler gets triggered by the system when
-
0:44
it goes through different stages of the request.
-
0:48
For example, when it sends the request, when it loads data in, and
-
0:53
when it's finished.
-
0:55
Node.js has a number of system events like reading data from a URL or
-
1:00
file, when an action is completed, and various error handling events.
-
1:07
We'll cover these throughout this course.
You need to sign up for Treehouse in order to download course files.
Sign up