RxJs Schedulers - Why do we need them? (Advanced, 2021)

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ธ.ค. 2024

ความคิดเห็น • 58

  • @DecodedFrontend
    @DecodedFrontend  3 ปีที่แล้ว +4

    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

  • @Lokus122
    @Lokus122 3 ปีที่แล้ว +25

    I answered correctly to all interview questions thanks to this channel

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว +1

      Really love to read stories like yours and I happy that my channel helped with that❤️ thanks for such a feedback!

  • @АндрейОвсяник-я5ь
    @АндрейОвсяник-я5ь 3 ปีที่แล้ว +19

    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

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว +6

      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 ;)

    • @АндрейОвсяник-я5ь
      @АндрейОвсяник-я5ь 3 ปีที่แล้ว +5

      @@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" ;)

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว

      @@АндрейОвсяник-я5ь and it was really awesome example! Currently investigating the lib you sent :)

    • @АндрейОвсяник-я5ь
      @АндрейОвсяник-я5ь 3 ปีที่แล้ว

      @@DecodedFrontend I have never seen it myself. Just googled it, because I thought there is such thing for sure :D

    • @ykristianhd
      @ykristianhd 2 ปีที่แล้ว

      What does CD mean? I'm new in RxJS 😊

  • @Billiam112
    @Billiam112 ปีที่แล้ว +1

    Best angular resource on youtube. I really hope you'll hit 100k followers within next year!

  • @rhea8133
    @rhea8133 3 ปีที่แล้ว +1

    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 !

  • @a_lodygin
    @a_lodygin 2 ปีที่แล้ว +1

    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)

  • @wojciechtrawinski75
    @wojciechtrawinski75 2 ปีที่แล้ว +3

    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

  • @p.s29
    @p.s29 3 ปีที่แล้ว +3

    Real life use case... 😅
    Thank you for uploading.

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว +1

      yeah.. as I said I have never used it in my daily work, so it was the best I could come up with 🤷🏼‍♂️😄

  • @malyna
    @malyna 2 ปีที่แล้ว +1

    Дякую! Чудове пояснення!

  • @debmallyabhattacharya4394
    @debmallyabhattacharya4394 2 ปีที่แล้ว +2

    Possible use case: Mocking API call delays.
    Useful during unit testing.

  • @БотировФарход
    @БотировФарход ปีที่แล้ว

    кайфую от твоей подачи) Помогает вырасти от уровня джуна -> мидла. От души Димон)

  • @tarassavchenko2317
    @tarassavchenko2317 2 ปีที่แล้ว

    this example of async is just a masterpiece, you are goood)

  • @aregsargsyan7689
    @aregsargsyan7689 3 ปีที่แล้ว +3

    I am faced with this problem just yesterday) thx for explanation Man

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว

      You are welcome! Great that it was useful 😉

  • @abdallahmeddah8461
    @abdallahmeddah8461 ปีที่แล้ว

    You can encounter this when you do rxjs testing, controlling the scheduller will help avoiding flaky tests

  • @arny699
    @arny699 2 ปีที่แล้ว

    Thank you. Really useful, especially your example with execution context.

  • @vitaliikarpenko5828
    @vitaliikarpenko5828 2 ปีที่แล้ว

    Man, you are really cool. I'm so happy that I've found you!

  • @vivmaniaa
    @vivmaniaa 3 ปีที่แล้ว +2

    You are awesome, Thank you for this video.

  • @hoangducnguyen8887
    @hoangducnguyen8887 ปีที่แล้ว +1

    Great video, I learn a lot!

  • @thm007
    @thm007 3 ปีที่แล้ว +1

    Brilliant explanation! Thank you!

  • @nelson3391
    @nelson3391 5 หลายเดือนก่อน

    Great explanation. Thanks a lot

  • @nobitanoby7609
    @nobitanoby7609 3 ปีที่แล้ว +2

    I really owe you so much... you are my demi god..❤️❤️

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว +1

      Thank you, Nobita! I am glad that my vids help :)

  • @jacksonoppenheim956
    @jacksonoppenheim956 3 ปีที่แล้ว +5

    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.

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว +1

      Great suggestion! I had already thoughts regarding it, so maybe any time soon I will make it ;)

  • @HenrikBgelundLavstsen
    @HenrikBgelundLavstsen 2 ปีที่แล้ว

    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

  • @bennineo6372
    @bennineo6372 3 ปีที่แล้ว

    Very nice. Thanks for posting!

  • @rezyadlf
    @rezyadlf 2 ปีที่แล้ว

    Dat "Small Note" appeared so suddenly, like some screamer in horror games )))

  • @demidovmaxim1008
    @demidovmaxim1008 3 ปีที่แล้ว +1

    Thank you so much!!!! It's great info

  • @markfrances4969
    @markfrances4969 2 ปีที่แล้ว +1

    really nice explaination

  • @samucancld
    @samucancld ปีที่แล้ว

    great content 👍

  • @markiianproniuk5741
    @markiianproniuk5741 3 ปีที่แล้ว

    thanks for the video, looks interesting

  • @MatiasAlibertti
    @MatiasAlibertti 3 ปีที่แล้ว

    Great content!

  • @zaktreister1995
    @zaktreister1995 2 ปีที่แล้ว

    Amazing I love your content

  • @beodan9219
    @beodan9219 ปีที่แล้ว

    awesome

  • @ВаноВано-л6р
    @ВаноВано-л6р 3 ปีที่แล้ว +3

    Димон красавелла)давай про горячие и холодные обсерваблы и где это может пригодиться!

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว +1

      Ну кстати есть уже в планах))

  • @pashabiceps95
    @pashabiceps95 4 หลายเดือนก่อน

    14:49 but why?

  • @akashchandran1
    @akashchandran1 3 ปีที่แล้ว +2

    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

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว +1

      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
      @akashchandran1 3 ปีที่แล้ว

      @@DecodedFrontend subscriptions are also async right 🤔. I may need to read more about it 🙂

    • @DecodedFrontend
      @DecodedFrontend  3 ปีที่แล้ว +6

      @@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 :)

  • @2762123
    @2762123 3 ปีที่แล้ว +1

    nice video

  • @krisnarusdiono1304
    @krisnarusdiono1304 3 ปีที่แล้ว

    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).

    • @krisnarusdiono1304
      @krisnarusdiono1304 3 ปีที่แล้ว

      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!

  • @praktycznewskazowki6733
    @praktycznewskazowki6733 3 ปีที่แล้ว +2

    pierwszy!

  • @ammardiarra1387
    @ammardiarra1387 2 ปีที่แล้ว

    games , in real times reports , thats somes of the appliations