Giter Site home page Giter Site logo

promise-lab's Introduction

Promise Lab in TypeScript

Welcome in this Promise lab.

You'll discover the so-called Promise mechanism in TypeScript.

๐Ÿงช Enter the Promise Lab ๐Ÿ”ฌ

You can follow the explanations to learn about Promises or you can just do the exercises to learn how to manipulate them.

The structure is quite self-explanatory. In each set of exercises you will find an answers.ts file in which you will have to implement your answer for each function. A file answer.test.ts will be useful to test your answers.

For each exercise, you have a script that can be executed to see if you have successed or not. Simply run npm run <name_of_the_exercice> where the name is one of the following:


Introduction

The Promise mechanism is used to perform action in an asynchronous way in Javascript (and TypeScript of course).

This object will represent an action that is to be either resolved, if everything went right, or rejected, if an error occured.

It will have 3 distinct status:

  • Pending
  • Fulfilled (or resolved)
  • Rejected

Initially the Promise has the pending status. It means that the action you asked to be done is not yet finished (not resolved nor rejected)

When the action is correclty done, you'll see the fulfilled status and you will gain access to the return value of the action. However, if something went wrong during the execution of the desired task, you'll see the rejected status and will gain access to the reason of the failure.

But let's walk through everything step-by-step. First, you need to see and learn how the adventure of Promise began :

๐Ÿผ The Creation of any Promise instance ! ๐Ÿผ

๐Ÿ‘‰ Next step : Creating a Promise ๐Ÿ‘ˆ

promise-lab's People

Contributors

thomasf34 avatar

Watchers

James Cloos avatar  avatar

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.