bf-asynchronous-programming

所属分类:其他
开发工具:HTML
文件大小:0KB
下载次数:0
上传日期:2024-05-06 01:38:03
上 传 者sh-1993
说明:  bf-asynchronous-programming, stars:1, update:2024-05-05 09:27:37

文件列表:
01-the-event-loop/
02-timeouts-and-intervals/
03-promises/
04-fake-fetching/
05-thinking-parallel/
06-promistaurant/
07-api-calls/
08-fetch-and-render/
09-reverse-engineer/
lesson-plans/
lib/
slides/
.babelrc
.dependency-cruiser.json
.prettierrc.json
LICENSE
package-lock.json
package.json
study.json
suggested-study.md

# Asynchronous Programming > "Synchronous basically means that you can only execute one thing at a time. Asynchronous means that you can execute multiple things at a time and you don't have to finish executing the current thing in order to move on to next one." > > - [Mike](https://stackoverflow.com/a/33585047) --- "The Internet", "The Web", "Web Apps". All of these terms describe something that is interconnected. If you zoom out a bit, the entire internet is basically billions of computers all sharing information and software! But so far your projects have been all alone on your computer :( Everything you have learned so far happens on the _callstack_, everything on the callstack executes _synchronously_. Synchronous means that each line of code will finish executing before the next one starts. Think of infinite loops, your browser freezes because nothing else can happen while the loop is looping! What makes web development so cool is the ... web. Being able to build applications that connect computers form across the internet. This also introduces some challenges, it can take some time for computers to talk to each other across the internet. You don't want your apps freezing while you wait to hear back from another computer. Enter _asynchronous programming_: writing code that tells your browser to start one task and move on to a new task while you wait for the first to finish. This is possible because of the _Event Loop_. - [Learning Objectives](#learning-objectives): what you can expect to learn from studying this material - [Suggested Study](./suggested-study.md): Helpful links for this module, useful but not required. ## Learning Objectives - You understand the JavaScript Event Loop, and can demonstrate this by using `setTimeout` and `setInterval` to schedule simple tasks. - You can explain why Asynchronous Programming is important for programs that have _blocking_ and _non-blocking_ tasks. - You can explain the basics of the Client/Server model and HTTP requests and can `fetch` data from RESTful APIs. - You can break down an asynchronous problem into smaller tasks and solve it using promises. This includes identify which tasks depend on each other and which are independent: - _dependent tasks_: The return value from one task is required to start the next task, these must be completed in a specific order - `.then` - _independent tasks_: These tasks do not use each other's return values, they can be completed at the same time - `Promise.all`system. - You can fetch data from an API and render it into the DOM using `/api-calls`, `/handlers` and `async`/`await` syntax. - You can write unit tests for functions that return promises using `async`/`await` syntax. [TOP](#asynchronous-programming) --- ### Running Tests You can also run tests directly from CLI using the NPM script: - `npm run test -- ./path/to/file.js`

近期下载者

相关文件


收藏者