Async Context Tracking in Node with Async Local Storage API ft. James Snell | JS Drops

Sdílet
Vložit
  • čas přidán 14. 02. 2023
  • In this JS Drop, James Snell goes over how Async Local Storage API works. He goes over the drawbacks of cascading functions for attaching information the traditional way, and why using Async Local Storage API (now stable) may be a more efficient use with Async Context Tracking.
    Follow James Snell on Twitter: / jasnell
    JS Drops offers bite sized tech content, presented by experts in the JavaScript ecosystem and beyond! Check in every Wednesday at 4:11PM ET for a brand new drop!
    JS Drops is presented by This Dot: www.thisdot.co/
    Follow This Dot Labs on Twitter: / thisdotlabs
    Follow This Dot Media on Twitter: / thisdotmedia
    Music Used: "EDM Detection Mode" Kevin MacLeod (incompetech.com)
    Licensed under Creative Commons: By Attribution 4.0 License
    creativecommons.org/licenses/b...
  • Věda a technologie

Komentáře • 9

  • @yakimovev
    @yakimovev Před 4 měsíci

    I finally understood! Thanks

  • @otmanm4095
    @otmanm4095 Před rokem +2

    Didn't know about that! Its super duper cool!

  • @johnm8358
    @johnm8358 Před rokem +2

    Very nicely explained

  • @user-lw1rh4pk3e
    @user-lw1rh4pk3e Před rokem

    Very well explained

  • @26Anshu
    @26Anshu Před rokem

    Hi, In your example you have set and access the data within same class. What if we set data in one class and want to access it in another class function invoked from this class?

    • @ThisDotMedia
      @ThisDotMedia  Před rokem

      Hi! As James mentions in the video at 14:45, so long as the ID provided by the declaration of new AsyncLocalStorage() can be shared with the functions, it would be possible.

    • @26Anshu
      @26Anshu Před rokem

      @@ThisDotMedia So, I need to pass the sessionId while invoking the other class function. There is no way to access the data without passing it?

    • @ThisDotMedia
      @ThisDotMedia  Před rokem

      @@26Anshu That's correct- you'll have to pass it.

    • @josht130
      @josht130 Před 8 měsíci

      Experiencing the same issue, frustrating that we need to propagate the store everywhere