Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JS: Async & Performance

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

JS: Async & Performance

Discussion of Promise pattern for JavaScript and your advantages front at normal callbacks use. Introduced the concept of WebWorkers and how it works.

Avatar for Bruno Stival Ferraro

Bruno Stival Ferraro

April 17, 2015
Tweet

Other Decks in Programming

Transcript

  1. • JS engine itself execute a single chunk at any

    given moment, when asked to. • JS engine runs inside a hosting environment • It's the surrounding environment that has always scheduled events on event loop
  2. • It normalizes the now and later • Behaves as

    a future value • On finish a task we can decide what to do next • Flow-control mechanism (this-then-that)
  3. • Call the callback too early • Even if that

    Promise was already resolved, the callback you provide to then(..) will always be called asynchronously
  4. • Calling Too Few or Too Many Times • Promises

    are defined so that they can only be resolved once
  5. • Parallel execution • Web worker (browser feature) • Multiple

    instances os JS engine each one in a thread. • Total independent processing • Not share scope or resources • Communication by event messages
  6. • Shared Workers • Dedicated worker for multiple tabs of

    same page • Communication by event messages by port