Coder Social home page Coder Social logo

javascript_promises's Introduction

#JavaScript Promises Udacity Course

##Lessons

  1. Callback vs Promises
  • Promise object is used for deferred and asynchronous computations.
  • asynchronous - happens at an unknown or unpredictable time
  1. Callbacks vs Thens
  • Add callback to a function and run at a later time when conditions are met
  • errors - how to handle
  • sequence of work - use .then
  1. Wrapping (Promise), thening (Promise->value->action), catching (Promise->value->recovery), chaining (Promise->value->promise->)
  1. How and when promises executed - event listener set after even fires, never gets called. First resolve promise, then set action for resolution value - then it will fire. Example: new Promise(function(resolve, reject){ resolve('hi'); //works resolve('bye'); //can't happen again }); - promise can only settle once - try and catch wrappers
  2. When to use: ajax requests, web worker (api) requests (work on separate threads and post data to main thread)

javascript_promises's People

Contributors

kelvink96 avatar motbsitu avatar

Watchers

 avatar  avatar

Forkers

djethales

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.