Stubbing out functions
This commit is contained in:
@@ -9,5 +9,25 @@
|
||||
<link rel="stylesheet" href="./src/site.css"></link>
|
||||
<script src="./src/axios.min.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
<body>
|
||||
<h1 class="green ml4">Consuming Promises</h1>
|
||||
<a class="green ml4 pb4" href="./home">Back to home</a>
|
||||
<div class="flex w-50 pa4">
|
||||
<button class="bg-green mr2" onclick="get()">Success GET</button>
|
||||
<button class="bg-green mr2" onclick="getCatch()">Failed GET</button>
|
||||
<button class="bg-green mr2" onclick="chain()">Promise Chain</button>
|
||||
<button class="bg-green mr2" onclick="final()">Final Update</button>
|
||||
</div>
|
||||
<div class="results w-50 ml4 mt4 pa4">
|
||||
<h1>Results</h1>
|
||||
</div>
|
||||
<script type="module">
|
||||
import { get, getCatch, chain, final } from "./src/consuming.mjs";
|
||||
|
||||
window.get = get;
|
||||
window.getCatch = getCatch;
|
||||
window.chain = chain;
|
||||
window.final = final;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -9,5 +9,31 @@
|
||||
<link rel="stylesheet" href="./src/site.css"></link>
|
||||
<script src="./src/axios.min.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
<body>
|
||||
<h1 class="blue ml4">Creating Promises</h1>
|
||||
<a class="blue ml4 pb4" href="./home">Back to home</a>
|
||||
<div class="flex w-50 pa4">
|
||||
<button class="bg-blue mr2" onclick="timeout()">Timeout</button>
|
||||
<button class="bg-blue mr2" onclick="interval()">Interval</button>
|
||||
<button class="bg-blue mr2" onclick="clearInterval()">Clear Interval</button>
|
||||
<button class="bg-blue mr2" onclick="xhr()">XHR</button>
|
||||
<button class="bg-blue mr2" onclick="allPromises()">All</button>
|
||||
<button class="bg-blue mr2" onclick="allSettled()">All Settled</button>
|
||||
<button class="bg-blue mr2" onclick="race()">Race</button>
|
||||
</div>
|
||||
<div class="results w-50 ml4 mt4 pa4">
|
||||
<h1>Results</h1>
|
||||
</div>
|
||||
<script type="module">
|
||||
import { timeout, interval, clearInterval, xhr, allPromises, allSettled, race } from "./src/creating.mjs";
|
||||
|
||||
window.timeout = timeout;
|
||||
window.interval = interval;
|
||||
window.clearInterval = clearInterval;
|
||||
window.xhr = xhr;
|
||||
window.allPromises = allPromises;
|
||||
window.allSettled = allSettled;
|
||||
window.race = race;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -9,5 +9,27 @@
|
||||
<link rel="stylesheet" href="./src/site.css"></link>
|
||||
<script src="./src/axios.min.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
<body>
|
||||
<h1 class="purple ml4">Iterating with Async & Await</h1>
|
||||
<a class="purple ml4 pb4" href="./home">Back to home</a>
|
||||
<div class="flex w-50 pa4">
|
||||
<button class="bg-purple mr2" onclick="get()">Get</button>
|
||||
<button class="bg-purple mr2" onclick="getCatch()">Handle Errors</button>
|
||||
<button class="bg-purple mr2" onclick="chain()">Chain</button>
|
||||
<button class="bg-purple mr2" onclick="concurrent()">Concurrent</button>
|
||||
<button class="bg-purple mr2" onclick="parallel()">Parparallelel</button>
|
||||
</div>
|
||||
<div class="results w-50 ml4 mt4 pa4">
|
||||
<h1>Results</h1>
|
||||
</div>
|
||||
<script type="module">
|
||||
import { get, getCatch, chain, concurrent, parallel } from "./src/iterating.mjs";
|
||||
|
||||
window.get = get;
|
||||
window.getCatch = getCatch;
|
||||
window.chain = chain;
|
||||
window.concurrent = concurrent;
|
||||
window.parallel = parallel;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,17 @@
|
||||
import setText from './results.mjs';
|
||||
|
||||
export function get(){
|
||||
setText('A');
|
||||
}
|
||||
|
||||
export function getCatch(){
|
||||
setText('B');
|
||||
}
|
||||
|
||||
export function chain(){
|
||||
setText('C');
|
||||
}
|
||||
|
||||
export function final(){
|
||||
setText('D');
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import setText from './results.mjs';
|
||||
|
||||
export function timeout(){
|
||||
setText('A');
|
||||
}
|
||||
|
||||
export function interval(){
|
||||
setText('B');
|
||||
}
|
||||
|
||||
export function clearInterval(){
|
||||
setText('C');
|
||||
}
|
||||
|
||||
export function xhr(){
|
||||
setText('D');
|
||||
}
|
||||
|
||||
export function allPromises(){
|
||||
setText('E');
|
||||
}
|
||||
|
||||
export function allSettled(){
|
||||
setText('F');
|
||||
}
|
||||
|
||||
export function race(){
|
||||
setText('G');
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import setText from './results.mjs';
|
||||
|
||||
export function get(){
|
||||
setText('A');
|
||||
}
|
||||
|
||||
export function getCatch(){
|
||||
setText('B');
|
||||
}
|
||||
|
||||
export function chain(){
|
||||
setText('C');
|
||||
}
|
||||
|
||||
export function concurrent(){
|
||||
setText('D');
|
||||
}
|
||||
|
||||
export function parallel(){
|
||||
setText('E');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1 class="blue ml4">Understanding Promises</h1>
|
||||
<h1 class="orange ml4">Understanding Promises</h1>
|
||||
<a class="orange ml4 pb4" href="./home">Back to home</a>
|
||||
<div class="flex w-50 pa4">
|
||||
<button class="bg-orange mr2" onclick="race()">Race Condition</button>
|
||||
<button class="bg-orange mr2" onclick="callbacks()">Callback Hell</button>
|
||||
|
||||
Reference in New Issue
Block a user