From 408b0baae674ec10cfbc5a0b844114d10af9bd8a Mon Sep 17 00:00:00 2001 From: Philippe Torrel Date: Wed, 23 Sep 2026 13:15:23 +0200 Subject: [PATCH] --- .../unterricht/tag13/01_pyramid-of-doom.html | 92 +++++++++++++++++++ .../unterricht/tag13/02_promise-aufbau.html | 59 ++++++++++++ 02_advanced/unterricht/tag13/03_node-hello.js | 1 + .../unterricht/tag13/04_node-fs-promise.js | 25 +++++ 4 files changed, 177 insertions(+) create mode 100644 02_advanced/unterricht/tag13/01_pyramid-of-doom.html create mode 100644 02_advanced/unterricht/tag13/02_promise-aufbau.html create mode 100644 02_advanced/unterricht/tag13/03_node-hello.js create mode 100644 02_advanced/unterricht/tag13/04_node-fs-promise.js diff --git a/02_advanced/unterricht/tag13/01_pyramid-of-doom.html b/02_advanced/unterricht/tag13/01_pyramid-of-doom.html new file mode 100644 index 0000000..6d41ddc --- /dev/null +++ b/02_advanced/unterricht/tag13/01_pyramid-of-doom.html @@ -0,0 +1,92 @@ + + + + + + The Pyramid Of The Doom - callback hell - Beispiel + + + + + +
+
+

The Pyramid Of The Doom - callback hell - Beispiel

+ + +
+
1
+
2
+
3
+
4
+
+
+
+ + + diff --git a/02_advanced/unterricht/tag13/02_promise-aufbau.html b/02_advanced/unterricht/tag13/02_promise-aufbau.html new file mode 100644 index 0000000..801d578 --- /dev/null +++ b/02_advanced/unterricht/tag13/02_promise-aufbau.html @@ -0,0 +1,59 @@ + + + + + + Promise Object - Syntax + + + +
+
+

Promise Object - Syntax

+

+ Das + Promise + Objekt stellt eine Repräsentation einer eventuellen Ausführung (oder eines Fehlschlags) einer + asynchronen + Operation und den daraus resultierenden Ergebnissen dar. +

+ +
+
+ + + diff --git a/02_advanced/unterricht/tag13/03_node-hello.js b/02_advanced/unterricht/tag13/03_node-hello.js new file mode 100644 index 0000000..a420803 --- /dev/null +++ b/02_advanced/unterricht/tag13/03_node-hello.js @@ -0,0 +1 @@ +console.log('Hello World!'); diff --git a/02_advanced/unterricht/tag13/04_node-fs-promise.js b/02_advanced/unterricht/tag13/04_node-fs-promise.js new file mode 100644 index 0000000..04c3295 --- /dev/null +++ b/02_advanced/unterricht/tag13/04_node-fs-promise.js @@ -0,0 +1,25 @@ +const fs = require('fs'); // Modul au der Standardlibrary von Node +// require - commonjs Schreibweise + +const getFile = (path = '') => { + return new Promise((resolve, reject) => { + // asynchrones auslesen einer Datei + fs.readFile(path, 'utf-8', (error, data) => { + if (error) { + // console.error(error); + reject(error); + } + + // console.log(data); + resolve(data); + }); + }); +}; + +console.log('weiter im code....'); +// more logic... + +// Funktionsaufruf einer Funktion, die asynchrone Prozesse beinhaltet +getFile('02_promise-aufbau.html') + .then((data) => console.log(data)) + .catch((err) => console.error(err));