YuezhenQin / responsive-web-design

1 stars 0 forks source link

axios #15

Open YuezhenQin opened 4 months ago

YuezhenQin commented 4 months ago

A “producing code” that does something and takes time. For instance, some code that loads the data over a network. That’s a “speaker”.

A “consuming code” that wants the result of the “producing code” once it’s ready. Many functions may need that result. These are the “listeners”.

A promise is a special JavaScript object that links the “producing code” and the “consuming code” together. In terms of our analogy: this is the “subscription list”. The “producing code” takes whatever time it needs to produce the promised result, and the “promise” makes that result available to all of the subscribed code when it’s ready.

YuezhenQin commented 4 months ago

Axios makes it easy to send asynchronous HTTP requests to REST endpoints and perform CRUD operations (create, read, update and delete), as well as handle the responses.