Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/newChapters/the_law/14_Pattern_AsyncBubble.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ This results in *two* variants of the AsyncBubble: an EventAsyncBubble and Promi
#### EventAsyncBubble

```javascript
;(async function () {
(async function () {
try {
//await something and
//other async code here
const event = new Event('my-custom-event-type');
const eventWithData = new Event('my-custom-event-type');
event.data = 'the data the AsyncBubble creates';
dispatchEvent(eventWithData);
EventTarget.dispatchEvent(eventWithData);
} catch (err) {
console.error("AsyncBubble failed:", err);
}
Expand Down Expand Up @@ -135,7 +135,7 @@ addEventListener('update', function (e) {
const derivativeOfSomething = await fetch(something);
const event = new Event('some-event');
event.data = derivativeOfSomething;
dispatchEvent(event);
EventTarget.dispatchEvent(event);
})();
});

Expand All @@ -146,7 +146,7 @@ addEventListener('some-event', function (e) {
const derivateOfderivative = await fetch(derivativeOfSomething);
const event = new Event('some-other-event');
event.data = derivateOfderivative;
dispatchEvent(event);
EventTarget.dispatchEvent(event);
})();
});

Expand All @@ -165,4 +165,4 @@ Mind you, the underlying race conditions are the same in both instances. But. Wh

## References

*
*