Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,770 --> 00:00:07,280
In this lecture, we're going to learn how to emit events from these set up function, previously we
2
00:00:07,280 --> 00:00:13,370
had to look at an alternative for accessing Rev's in the script section of the component that you likes
3
00:00:13,370 --> 00:00:19,340
to inject global methods and properties via this keyword, since we're working with the composition
4
00:00:19,340 --> 00:00:20,030
API.
5
00:00:20,270 --> 00:00:22,280
Those global functions are gone.
6
00:00:22,820 --> 00:00:26,480
In some cases, we may need to emit custom events.
7
00:00:26,510 --> 00:00:32,390
Events can be emitted from components by calling the this dollar Sinemet function.
8
00:00:34,950 --> 00:00:40,800
We don't have access to this function from the this keyword, if we want to emit events, we'll need
9
00:00:40,800 --> 00:00:43,550
to update the parameters of the set up function.
10
00:00:44,010 --> 00:00:46,320
Currently, I'm in the alert component.
11
00:00:46,620 --> 00:00:52,950
We're accessing the props via the props parameters, the second parameter of the set of function if
12
00:00:52,950 --> 00:00:55,950
we choose to use it as the context object.
13
00:00:58,520 --> 00:01:05,300
The context object gives us access to information about the component it's being used in, this object
14
00:01:05,300 --> 00:01:10,280
comes with the Imit function we would regularly encounter in the this object.
15
00:01:10,610 --> 00:01:15,650
If we want to emit an event, we can call the context Emet function.
16
00:01:18,270 --> 00:01:25,290
The Imit function has the same arguments as the this stop dollar sign Sinemet function, the first argument
17
00:01:25,290 --> 00:01:26,750
is the name of the event.
18
00:01:27,180 --> 00:01:29,080
This can be a custom named event.
19
00:01:29,520 --> 00:01:33,360
The second argument is a payload to send to event listeners.
20
00:01:33,360 --> 00:01:37,990
If there are any, we are going to omit any events from this component.
21
00:01:38,280 --> 00:01:42,170
I just wanted to show you can Emet events if you ever need to.
22
00:01:42,450 --> 00:01:47,640
I'm going to remove this line as well as remove the context parameter from the function.
23
00:01:50,200 --> 00:01:53,620
After making those changes, I'll see you in the next lecture.
2428
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.