All language subtitles for 5. Async Get exchanges

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,120 --> 00:00:05,880 In the last lecture, I have learned about the mutations in these électoral continue with more changes 2 00:00:06,210 --> 00:00:08,760 in the way, how are getting the data? 3 00:00:09,960 --> 00:00:14,880 All right, let's start with our index story is as in the previous lecture, I'll be doing small refactoring. 4 00:00:15,120 --> 00:00:18,340 This has nothing to do with Vucic's functionality. 5 00:00:18,360 --> 00:00:24,200 This will be just a simple function that will simulate the fetch request that can happen to the browser. 6 00:00:24,240 --> 00:00:30,060 The Fed treatments that will go to the Firebase to get a data so they are simulating as closely as possible. 7 00:00:30,300 --> 00:00:31,350 This functionality? 8 00:00:32,340 --> 00:00:35,160 OK up here will create just normal function. 9 00:00:36,120 --> 00:00:37,770 L'Equipe fetch exchanges. 10 00:00:38,430 --> 00:00:40,080 Fetch exchanges. 11 00:00:41,300 --> 00:00:43,590 Exchange chess. 12 00:00:43,730 --> 00:00:44,210 All right. 13 00:00:44,600 --> 00:00:50,000 And will the arrow function, this arrow function will be returning the promise, that's what they usually 14 00:00:50,000 --> 00:00:50,840 happen eventually. 15 00:00:50,900 --> 00:00:54,350 Then you are asking for a data on the internet you are. 16 00:00:54,440 --> 00:01:00,140 You're expecting to receive the promise, and a promise is a data structure that will be resolved after 17 00:01:00,140 --> 00:01:01,100 some time. 18 00:01:01,670 --> 00:01:06,560 So promises usually use when you're opening the files on their computer or they are doing some asynchronous 19 00:01:06,560 --> 00:01:13,010 operations, such as making the request on the internet because you don't know exactly after which time 20 00:01:13,010 --> 00:01:17,150 period this data will get resolved and you will receive them into your codes back. 21 00:01:18,230 --> 00:01:23,330 So for this proposal, I will just create a simulation of the new web promise so you don't hear a new 22 00:01:23,330 --> 00:01:28,070 promise that's you will do it like this and to the promise, you will specify the callback function 23 00:01:28,070 --> 00:01:28,520 like this. 24 00:01:29,450 --> 00:01:29,840 OK. 25 00:01:30,770 --> 00:01:34,880 And here we can set up a timeout, so I will set the zero set timeout. 26 00:01:36,050 --> 00:01:36,500 OK two. 27 00:01:36,500 --> 00:01:42,320 The one second video specified the before and I will say here or this promise will be resolved after 28 00:01:42,320 --> 00:01:42,800 one second. 29 00:01:42,800 --> 00:01:48,500 So it's specified here one thousand in the promise of the parameters of these public functions. 30 00:01:48,500 --> 00:01:52,160 Through the Promise API you are receiving here two functions. 31 00:01:52,160 --> 00:01:53,210 One is called resolve. 32 00:01:53,220 --> 00:01:54,680 The other one is called the reject. 33 00:01:55,010 --> 00:01:59,430 For now, we just need to resolve in the resolve your specified data. 34 00:01:59,450 --> 00:02:01,520 You want to be this promise a result. 35 00:02:02,570 --> 00:02:04,490 In this case, our exchanges appear. 36 00:02:05,950 --> 00:02:08,740 OK, so specify here exchanges. 37 00:02:10,800 --> 00:02:15,900 OK, perfect not have fetched exchanges, and we can completely change this function, get data here. 38 00:02:16,200 --> 00:02:18,270 I don't need to call here any longer as a timeout. 39 00:02:19,440 --> 00:02:22,550 I can remove it and I can simply call here. 40 00:02:23,610 --> 00:02:26,970 Exchanges, I will execute it and I will sign here. 41 00:02:27,120 --> 00:02:29,370 Const exchanges. 42 00:02:31,400 --> 00:02:37,880 OK, this conflict will be working synchronously, because remember of each exchange's great promise. 43 00:02:38,660 --> 00:02:43,870 So what you would get here would be will be not your data of the exchanges, but will be actual promise 44 00:02:44,030 --> 00:02:47,470 structure and the committee will pass promise structure. 45 00:02:47,480 --> 00:02:53,980 But you never you will never get your data in order to resolve the promise you need to make here. 46 00:02:53,990 --> 00:02:54,500 Evade. 47 00:02:55,520 --> 00:02:59,910 So you'll be waiting here until you receive your data and we'll debug it for you. 48 00:02:59,930 --> 00:03:01,310 But let's wait for this. 49 00:03:03,010 --> 00:03:08,200 When you want to use the keyboard to, you need to mark your function as the async so async get exchanges. 50 00:03:09,250 --> 00:03:13,540 OK, so let's recapitulate a little bit what's happening here. 51 00:03:14,560 --> 00:03:18,820 We are calling exchanges such exchanges written promise. 52 00:03:20,070 --> 00:03:25,230 Promised will be executed immediately, these faction will be executed, but as you can see here we 53 00:03:25,230 --> 00:03:26,600 are sitting here again timeout. 54 00:03:26,610 --> 00:03:32,370 So the callback function of the settlement will be executed after 1000 milliseconds. 55 00:03:33,000 --> 00:03:39,090 Since you have here, evade you are waiting here, you are not continuing to commit Antilla. 56 00:03:39,480 --> 00:03:44,520 Death will be resolved, so you are still here after one second. 57 00:03:44,910 --> 00:03:49,140 Here you will call a resolve and you will pursue the resolve exchanges. 58 00:03:49,680 --> 00:03:51,210 The exchanges data you have up here. 59 00:03:52,560 --> 00:03:58,080 So after one second thought of it, fixed fetch exchange escalated your exchanges here, and you can 60 00:03:58,080 --> 00:04:00,870 commit them today to the state, and that's it. 61 00:04:02,620 --> 00:04:06,310 And that's usually how you will see through the Firebirds, actually the thoroughbreds, they have their 62 00:04:06,310 --> 00:04:09,970 own API, but in a in the background it works similarly like this? 63 00:04:11,080 --> 00:04:12,100 OK, let's say it, guys. 64 00:04:12,100 --> 00:04:13,760 Let's go to pause utility. 65 00:04:14,050 --> 00:04:18,010 And after one second, you will receive your data as a beforo so you can see the visually there are 66 00:04:18,010 --> 00:04:19,960 no changes, but we change it little bit. 67 00:04:22,000 --> 00:04:24,100 OK, let's get the bag here, and let's. 68 00:04:24,490 --> 00:04:27,010 Yeah, maybe we can debug it or we can. 69 00:04:27,320 --> 00:04:30,220 Yeah, let's play a couple of days, so have an idea what's happening here? 70 00:04:30,410 --> 00:04:37,660 I've read one debug here run debug an app, an ability to give a data run debugger to get here, promise 71 00:04:37,660 --> 00:04:40,870 and debug into the set timeout. 72 00:04:41,830 --> 00:04:47,770 Our London bureau here, let's let's floated a bit edited by Gareth, sort of idea what's happening. 73 00:04:48,970 --> 00:04:50,740 OK, let's go to Bhavsar. 74 00:04:50,740 --> 00:04:53,020 Let's open the console here and refresh. 75 00:04:53,260 --> 00:04:56,350 Maybe I need to refresh Device two in order to jump into your code. 76 00:04:57,160 --> 00:05:00,970 OK, so you can see here first, we have this section together exchanges. 77 00:05:00,970 --> 00:05:02,890 So we are calling here again the exchanges. 78 00:05:04,000 --> 00:05:06,100 Here we are, calling the exchanges function. 79 00:05:07,000 --> 00:05:11,140 OK, so but I believe one of our this I will click here is Arrow three, some script execution. 80 00:05:11,140 --> 00:05:16,330 I will jump into the next step back here, which is the fetch exchanges, because we called it here, 81 00:05:16,330 --> 00:05:16,900 down here. 82 00:05:18,400 --> 00:05:20,160 OK, we have contacts for exchanges. 83 00:05:20,170 --> 00:05:24,910 We are returning here and you promise as soon as then you instance of the promise is created. 84 00:05:25,180 --> 00:05:27,580 The callback function inside is execute that. 85 00:05:27,580 --> 00:05:28,440 So then I will click here. 86 00:05:28,440 --> 00:05:30,850 Every subsequent execution l'll jump instead of the promise. 87 00:05:31,750 --> 00:05:36,190 As you can see, here we are at the retrieving carousel function in promise. 88 00:05:36,190 --> 00:05:40,510 We are calling a timeout which will be executed after one seconds, but I look like this. 89 00:05:40,510 --> 00:05:41,470 I'm script execution. 90 00:05:41,470 --> 00:05:47,500 I will be hanging here for one second and then I will jump into this line here, so I will click here 91 00:05:47,500 --> 00:05:49,780 again based on script execution. 92 00:05:49,780 --> 00:05:54,190 And it will see actually, I was waiting too long in my debugger. 93 00:05:54,190 --> 00:05:56,100 Disconnected or something happen here. 94 00:05:56,110 --> 00:05:57,970 Let me see one more time, so go faster. 95 00:05:58,270 --> 00:06:03,910 Here, here, here, waiting one second and going to the debugger here you can see that there was this 96 00:06:03,910 --> 00:06:04,810 timeout one second. 97 00:06:05,650 --> 00:06:07,360 And then I also think my exchanges. 98 00:06:08,980 --> 00:06:13,920 And as soon as I voice my exchanges and I will click here, continue script execution, I will jump 99 00:06:13,930 --> 00:06:15,790 here and I have exchanges here now. 100 00:06:17,370 --> 00:06:17,630 OK. 101 00:06:17,850 --> 00:06:23,730 These exchanges here, and I can send them to the comet and the comet, I like it here and that also 102 00:06:23,730 --> 00:06:25,110 they said excellent this year. 103 00:06:26,410 --> 00:06:31,180 So I can even get him a break point on line 58, so just click on the line there is like a debugger 104 00:06:31,480 --> 00:06:36,460 and you can click click here and you should jump here and to the state of exchanges, you can see the 105 00:06:36,460 --> 00:06:42,350 error zero zero said Here state, you have a here area of two and you're having a state, your exchanges 106 00:06:42,370 --> 00:06:44,920 and your consulate properties in the your home page. 107 00:06:44,920 --> 00:06:47,830 Reacting to this and you will read through the exchanges there. 108 00:06:50,350 --> 00:06:54,510 OK, so that's how it works, but I will show you one more time, but I will increase your time out. 109 00:06:54,790 --> 00:06:56,740 Maybe it's more obvious here to three seconds. 110 00:06:59,060 --> 00:07:02,060 OK, I will do some scripts execution a couple of times, so I will go. 111 00:07:03,110 --> 00:07:06,440 Hop, hop, hop waiting three seconds until three. 112 00:07:07,610 --> 00:07:14,270 And then in a timeout and then having resolving and then I'm getting data, so as you could see, we 113 00:07:14,270 --> 00:07:18,710 didn't continue here straight on this line because we have it here. 114 00:07:19,880 --> 00:07:25,010 If I if I will do this, I will show you I will go to actions and I will remove the right here. 115 00:07:25,040 --> 00:07:25,970 This will be a complete mess. 116 00:07:25,970 --> 00:07:28,490 No, I will just save it without the evade. 117 00:07:28,490 --> 00:07:31,990 I will be not debating here until the face off will be executed. 118 00:07:32,000 --> 00:07:32,840 Somewhat will happen. 119 00:07:34,880 --> 00:07:37,790 I'll fresh Elago immediately here. 120 00:07:38,920 --> 00:07:39,640 You can see if he didn't. 121 00:07:40,410 --> 00:07:44,410 You know, maybe I'll get to hear a promise, which is a pending, but didn't wait for a promise or 122 00:07:44,410 --> 00:07:45,610 we don't have a correction just. 123 00:07:46,560 --> 00:07:47,220 Have you got here? 124 00:07:47,700 --> 00:07:49,500 Promise basically what they're sitting here. 125 00:07:50,580 --> 00:07:52,620 And yeah, that's overall not good. 126 00:07:54,420 --> 00:08:00,690 So, guys, that's basically what's happening, and I can get rid of this day by and lots of it, because 127 00:08:00,690 --> 00:08:01,710 that's what should be here. 128 00:08:01,710 --> 00:08:07,560 Remember, whenever you are working with be very request to the network, they usually return promise. 129 00:08:08,550 --> 00:08:12,510 Let's not get back to the one second, one second and let's remove all that the debugger as we don't 130 00:08:12,510 --> 00:08:14,100 need to build on it and it like it is here. 131 00:08:16,660 --> 00:08:17,250 Okay. 132 00:08:17,330 --> 00:08:19,750 And that's going to be it. 133 00:08:20,080 --> 00:08:24,200 So if you see sometimes when you will inspect any functions and you'll see that it returns, promise. 134 00:08:24,200 --> 00:08:26,670 So this arrow here of the brackets and you will see it. 135 00:08:26,710 --> 00:08:27,400 I don't promise. 136 00:08:27,560 --> 00:08:31,030 Remember usually to synchronize a to evade keyboard. 137 00:08:32,150 --> 00:08:37,550 OK, so that's going to be it for now, guys, go back to here and after effects, you should see your 138 00:08:37,550 --> 00:08:44,390 data up there on second look onto next lecture and I will show you how you can make your view more modular. 139 00:08:44,690 --> 00:08:47,060 So, guys, I hope to see you the next lecture. 13611

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.