-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
58 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Promise | ||
|
||
## 1 | ||
### a | ||
Schreibe eine Funktion calcX, | ||
- die eine Zahl z zwischen 0 und 1 entgegen nimmt | ||
- ein Promise retourniert, welches bei einer Zahl | ||
- \>= 0.8 diese als Fehler rejected | ||
- < 0.8 diese Zahl resolved | ||
|
||
Signatur: `calcX(Number): Promise<Number>` | ||
|
||
Rufe die Funktion 10 mal auf und logge die Ergebnisse. | ||
|
||
### b | ||
Ergänze calcX so, dass Sie jeweils um (Math.random()*100)ms wartet bevor sie ein Resultat generiert. | ||
Rufe die Funktion 10 mal auf und logge die Ergebnisse. | ||
|
||
Was ist anders im Vergleich zum Verhalten unter 1a? | ||
|
||
### c | ||
Rufe die Funktion calcX 10 mal auf, summiere alle erfolgreichen Werte. Logge die fehlschläge. | ||
Verwende jeweils i/10 als Parameterwert. | ||
|
||
|
||
## 2 | ||
Zeichne für folgende Code-Schnippsel ein Ablaufdiagram aller möglichen Abläufe. | ||
|
||
### a | ||
``` | ||
getDetails(card.id) | ||
.then(initDetails.bind(null, card)) | ||
.finally(loading.bind(null, false)) | ||
``` | ||
|
||
### b | ||
``` | ||
showExecuteListConfirmationDialog() | ||
.then(callExecuteApi.bind(null, paymentsForExecution)) | ||
.then(done.bind(null, true)) | ||
.then(MessageBus.publish.bind(null, 'paymentListExecuted', paymentList, executionDate)) | ||
.catch(handleError) | ||
``` | ||
|
||
### c | ||
``` | ||
indicateLoading(true) | ||
.then(loadRegions.bind(null, card.id)) | ||
.then(assignRegions) | ||
.catch(handleError) | ||
.finally(indicateLoading.bind(this, false)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
|
||
export {Person} from './person.js' | ||
export {Store} from './store.js' |