If would like to know more how browser handles async stuff, event loop, etc then please check this video. It is probably the best explenation I have every seen th-cam.com/video/8aGhZQkoFbQ/w-d-xo.html
ngx-rxjs-zone-scheduler leaveNgZone scheduler can be used to run some code outside of ngZone. For example if you need to do some heavy computations, but you split them into several 10ms computations to leave the UI working - with this scheduler unnecessary change detections won't be run. Even Dmytro's example with loading animation could be improved, because it is unnecessary to run the change detection on every frame in this case, and styles could be updated without CD
Awesome! I didn't know about that ngx-rxjs-zone-scheduler library, thank you! And good point regarding CD, it didn't mentioned it because it is a bit another topic but I hope my audience read comments ;)
@@DecodedFrontend Yeah, I wasn't trying to say that the implementation in the video is bad. It is great for describing a concept. Just proposing some kind of "real life use case" ;)
I feel so empowered when i see your videos. and your wording and method of speech is so easy to understand and connect to. i look forward to every single of your videos. keep up the awesome work and thanks a lot !
I usually use animationFrameScheduler with fromEvent(this.window, 'resize'). Also, it's useful to use with dynamic components. You can reduce frame drops during appearing of a component by scheduling the painting phase on the next frame (you shouldn't compute all the necessary stuff for component creation and draw it in the particular frame simultaneously)
Nice explanation 😉 other use cases I can think of: mocking data with the of observable with asyncScheduler so that it behaves as with real data and during testing RxJS streams which are time based - using Test scheduler
This was awesome and super informative! I’ve always wondered why SchedulerLike was a type in so many operators! What would you think about a video on writing tests with observables? Maybe marble tests? I’ve always struggled to understand how to get those working, but I see all over the place that they’re really useful and help you understand how observable work.
I actually had an issue with a timer bar with continuously adjusting times. It had weird lags, but i did not know about the animationFrameScheduler. Seems to work like a charm
I have one doubt here. 1 - console.log("Regular console log"); 2 - requestAnimation Frame (() => console.log("Animation frame callback")); 3 - setTimeout(() => console.log("setTimeout callback"), 0); 4 - Promise.resolve("Promise value").then(console.log); 5 - of ("Stream value").subscribe(console.log); why the "stream value" printed even before the "promise value". Could you please explain that a bit? Thanks
It is because requestAnimationFrame, setTimeout, Promise are async operations when console.log and of("Stream value") are sync. Async operations will be executed always after sync ones, so that's why "stream value" is printed before promise
@@akashchandran1 not all of them :) They can be sync and async. As example of("Stream value").subscribe(console.log); is sync but if you do something like: of ("Stream value").pipe(delay(0)).subscribe(console.log); it will make it async :)
So far i am practicing myself to use async and await on my script in order to force it to execute any API request one by one, i still have to learn much to implemet rxjs operator in my project lmao. Dymitro, i just wondering how to get such a realtime notification on my project? like when someone posting a new student data's then it will push other user a notification (either couter at bell icon or a snackbar).
oh, and i just realize that your channel grow up so fast ... last time i see you still have around 2k subs. now look at that! no doubt why you grow so fast ! congrats!
If would like to know more how browser handles async stuff, event loop, etc then please check this video. It is probably the best explenation I have every seen th-cam.com/video/8aGhZQkoFbQ/w-d-xo.html
I answered correctly to all interview questions thanks to this channel
Really love to read stories like yours and I happy that my channel helped with that❤️ thanks for such a feedback!
ngx-rxjs-zone-scheduler leaveNgZone scheduler can be used to run some code outside of ngZone. For example if you need to do some heavy computations, but you split them into several 10ms computations to leave the UI working - with this scheduler unnecessary change detections won't be run.
Even Dmytro's example with loading animation could be improved, because it is unnecessary to run the change detection on every frame in this case, and styles could be updated without CD
Awesome! I didn't know about that ngx-rxjs-zone-scheduler library, thank you! And good point regarding CD, it didn't mentioned it because it is a bit another topic but I hope my audience read comments ;)
@@DecodedFrontend Yeah, I wasn't trying to say that the implementation in the video is bad. It is great for describing a concept. Just proposing some kind of "real life use case" ;)
@@АндрейОвсяник-я5ь and it was really awesome example! Currently investigating the lib you sent :)
@@DecodedFrontend I have never seen it myself. Just googled it, because I thought there is such thing for sure :D
What does CD mean? I'm new in RxJS 😊
Best angular resource on youtube. I really hope you'll hit 100k followers within next year!
Thank you! I hope so ✌️🤞
I feel so empowered when i see your videos. and your wording and method of speech is so easy to understand and connect to. i look forward to every single of your videos. keep up the awesome work and thanks a lot !
I usually use animationFrameScheduler with fromEvent(this.window, 'resize').
Also, it's useful to use with dynamic components. You can reduce frame drops during appearing of a component by scheduling the painting phase on the next frame (you shouldn't compute all the necessary stuff for component creation and draw it in the particular frame simultaneously)
Nice explanation 😉 other use cases I can think of: mocking data with the of observable with asyncScheduler so that it behaves as with real data and during testing RxJS streams which are time based - using Test scheduler
Real life use case... 😅
Thank you for uploading.
yeah.. as I said I have never used it in my daily work, so it was the best I could come up with 🤷🏼♂️😄
Дякую! Чудове пояснення!
Possible use case: Mocking API call delays.
Useful during unit testing.
кайфую от твоей подачи) Помогает вырасти от уровня джуна -> мидла. От души Димон)
this example of async is just a masterpiece, you are goood)
I am faced with this problem just yesterday) thx for explanation Man
You are welcome! Great that it was useful 😉
You can encounter this when you do rxjs testing, controlling the scheduller will help avoiding flaky tests
Thank you. Really useful, especially your example with execution context.
Man, you are really cool. I'm so happy that I've found you!
You are awesome, Thank you for this video.
Great video, I learn a lot!
Brilliant explanation! Thank you!
Great explanation. Thanks a lot
I really owe you so much... you are my demi god..❤️❤️
Thank you, Nobita! I am glad that my vids help :)
This was awesome and super informative! I’ve always wondered why SchedulerLike was a type in so many operators!
What would you think about a video on writing tests with observables? Maybe marble tests? I’ve always struggled to understand how to get those working, but I see all over the place that they’re really useful and help you understand how observable work.
Great suggestion! I had already thoughts regarding it, so maybe any time soon I will make it ;)
I actually had an issue with a timer bar with continuously adjusting times. It had weird lags, but i did not know about the animationFrameScheduler. Seems to work like a charm
Very nice. Thanks for posting!
Dat "Small Note" appeared so suddenly, like some screamer in horror games )))
Thank you so much!!!! It's great info
really nice explaination
great content 👍
thanks for the video, looks interesting
Great content!
Amazing I love your content
awesome
Димон красавелла)давай про горячие и холодные обсерваблы и где это может пригодиться!
Ну кстати есть уже в планах))
14:49 but why?
I have one doubt here.
1 - console.log("Regular console log");
2 - requestAnimation Frame (() => console.log("Animation frame callback"));
3 - setTimeout(() => console.log("setTimeout callback"), 0);
4 - Promise.resolve("Promise value").then(console.log);
5 - of ("Stream value").subscribe(console.log);
why the "stream value" printed even before the "promise value". Could you please explain that a bit?
Thanks
It is because requestAnimationFrame, setTimeout, Promise are async operations when console.log and of("Stream value") are sync. Async operations will be executed always after sync ones, so that's why "stream value" is printed before promise
@@DecodedFrontend subscriptions are also async right 🤔. I may need to read more about it 🙂
@@akashchandran1 not all of them :) They can be sync and async. As example of("Stream value").subscribe(console.log); is sync but if you do something like: of ("Stream value").pipe(delay(0)).subscribe(console.log); it will make it async :)
nice video
Thanks 😊
So far i am practicing myself to use async and await on my script in order to force it to execute any API request one by one, i still have to learn much to implemet rxjs operator in my project lmao. Dymitro, i just wondering how to get such a realtime notification on my project? like when someone posting a new student data's then it will push other user a notification (either couter at bell icon or a snackbar).
oh, and i just realize that your channel grow up so fast ... last time i see you still have around 2k subs. now look at that!
no doubt why you grow so fast ! congrats!
pierwszy!
games , in real times reports , thats somes of the appliations
Could you detail a bit more how they're useful in real time reports please?