Skip to content

Commit 6ec86b4

Browse files
authored
Merge pull request #315 from lab-antwerp-1/promise-vocab
aviv; vocab; promise and promise states
2 parents 4ba8c1b + 34894e4 commit 6ec86b4

4 files changed

Lines changed: 69 additions & 14 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ locally.
117117
<li><h3><a href="https://home.hackyourfuture.be/curriculum/final-project" style="display: inline">final-project</a></h3> <ul><li><p> 5 chapters | <a href="https://github.com/lab-antwerp-1/home/projects/1?card_filter_query=label%3Adeliverable+milestone%3Afinal-project">deliverables</a> | <a href="https://github.com/lab-antwerp-1/home/issues?q=milestone%3Afinal-project+label%3Acheck-in">check-ins</a> | <a href="https://github.com/lab-antwerp-1/home/milestone/12">milestone</a> | <a href="https://github.com/HackYourFutureBelgium/final-project">materials</a> </p></li></ul></li>
118118
</ol><br>
119119

120-
121120
[TOP](#home)
121+
122122
<!-- END MODULES -->
123123

124124
---
@@ -390,8 +390,8 @@ locally.
390390
</table> </li>
391391
</ul><br>
392392

393-
394393
[TOP](#home)
394+
395395
<!-- END STUDENTS -->
396396

397397
---
@@ -637,8 +637,8 @@ locally.
637637
</tr></table></li>
638638
</ul><br>
639639

640-
641640
[TOP](#home)
641+
642642
<!-- END COACHES -->
643643

644644
---

calendar/index.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@
3535
/>
3636
</div>
3737
</nav>
38-
3938
<br />
4039
<p class="words">
41-
Here you can find the the updated class calendars for carrer-skill session
40+
Here you can find the the updated class calendars for career-skill session
4241
workshops and the curriculum. Please check the calendars for updated
4342
weekly information.
4443
</p>
@@ -47,14 +46,7 @@
4746
<div class="container">
4847
<div class="position-relative">
4948
<p
50-
class="
51-
position-absolute
52-
top-100
53-
start-50
54-
translate-middle
55-
mt-1
56-
bi bi-caret-down-fill
57-
"
49+
class="position-absolute top-100 start-50 translate-middle mt-1 bi bi-caret-down-fill"
5850
>
5951
<button
6052
class="btnn"

snippets/javascript/replace-with-alphabet-position-snippet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# A function which replaces letters with its alphabet position.
1+
# A function which replaces letters with its alphabet position
22

33
```js
44
/**
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# promise and promise states
2+
3+
## intro
4+
5+
> in order to understand promises we must first understand why promises are
6+
> needed. When we run a program which relies on multiple events happening at
7+
> different times we have two options; we can either wait for each event to
8+
> conclude before moving to the next (synchronous), or we can launch multiple
9+
> events at the same time and set up protocols for how to interact with each
10+
> event, when and if they conclude(asynchronous). this is why we need promises.
11+
12+
## promises
13+
14+
### description
15+
16+
> promises are objects created to help us set protocols for the asynchronous
17+
> events described above.
18+
19+
- promises 'store' the event data set up by the program.
20+
- promises receive instructions set by the program on how to handle the event
21+
data at its various states.
22+
23+
### promise states
24+
25+
> let's say we created a promise for a fetch event where the program calls for
26+
> data from an external source. our promise might exist in one or more of three
27+
> states:
28+
29+
#### pending
30+
31+
> a pending promise is a promise for an ongoing event; in the example above our
32+
> promise will be pending while the data from the external api hasn't been
33+
> received yet.
34+
35+
- the program must define a protocol for how to handle the data once it is
36+
received and/or rejected or the promise will remain pending forever.
37+
38+
#### resolved
39+
40+
> once the data has been received from the external source it can be handled by
41+
> the protocols set by the program. we can now say that the promise was
42+
> resolved.
43+
44+
- multiple protocols could be assigned to a single promise event on what is
45+
called a 'chain'.
46+
47+
#### rejected
48+
49+
> promises do not always resolve in a way that is compatible to the protocols we
50+
> have set up. for example; what if the external source does not have the data
51+
> the fetch event is looking for? in this case we can say the promise was
52+
> rejected, and our program should be able to handle unexpected or undesirable
53+
> outcomes without them breaking the rest of the code.
54+
55+
- reject protocols are set by the program to handle intentional promise outcomes
56+
that are incompatible with the resolve protocols.
57+
- reject protocols also handle any unintentional errors that may occur from the
58+
promise event.
59+
60+
### references
61+
62+
- for more information check out this
63+
[video](https://www.youtube.com/watch?v=QO4NXhWo_NM&t=4s)

0 commit comments

Comments
 (0)