Skip to content

1.14.7 #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 4, 2025
Merged
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
449 changes: 209 additions & 240 deletions 1-js/99-js-misc/07-weakref-finalizationregistry/article.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -10,14 +10,14 @@
<body>

<div class="app">
<button class="start-messages">Start sending messages</button>
<button class="start-messages">Začít posílat zprávy</button>
<div class="window">
<div class="window__header">
<p class="window__title">Messages:</p>
<button class="window__button">Close</button>
<p class="window__title">Zprávy:</p>
<button class="window__button">Zavřít</button>
</div>
<div class="window__body">
No messages.
Žádné zprávy.
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
const startMessagesBtn = document.querySelector('.start-messages'); // (1)
const closeWindowBtn = document.querySelector('.window__button'); // (2)
const windowElementRef = new WeakRef(document.querySelector(".window__body")); // (3)
const tlačítkoZačítPosílat = document.querySelector('.start-messages'); // (1)
const tlačítkoZavřítOkno = document.querySelector('.window__button'); // (2)
const odkazNaElementOkna = new WeakRef(document.querySelector(".window__body")); // (3)

startMessagesBtn.addEventListener('click', () => { // (4)
startMessages(windowElementRef);
startMessagesBtn.disabled = true;
tlačítkoZačítPosílat.addEventListener('click', () => { // (4)
startMessages(odkazNaElementOkna);
tlačítkoZačítPosílat.disabled = true;
});

closeWindowBtn.addEventListener('click', () => document.querySelector(".window__body").remove()); // (5)
tlačítkoZavřítOkno.addEventListener('click', () => document.querySelector(".window__body").remove()); // (5)


const startMessages = (element) => {
const timerId = setInterval(() => { // (6)
const začniPosílatZprávy = (element) => {
const idČasovače = setInterval(() => { // (6)
if (element.deref()) { // (7)
const payload = document.createElement("p");
payload.textContent = `Message: System status OK: ${new Date().toLocaleTimeString()}`;
element.deref().append(payload);
const zátěž = document.createElement("p");
zátěž.textContent = `Zpráva: Stav systému OK: ${new Date().toLocaleTimeString()}`;
element.deref().append(zátěž);
} else { // (8)
alert("The element has been deleted."); // (9)
clearInterval(timerId);
alert("Element byl odstraněn."); // (9)
clearInterval(idČasovače);
}
}, 1000);
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="index.css">
<title>Photo Library Collage</title>
<title>Koláž fotoknihovny</title>
</head>

<body>

<div class="app">
<header class="header">
<h1 class="header-text">
Photo Library Collage
Koláž fotoknihovny
</h1>
</header>
<div class="container">
@@ -24,9 +24,9 @@ <h1 class="header-text">
<div>
<div class=actions>
<select class="select"></select>
<button class="btn btn--primary btn-create-collage"> Create collage </button>
<button class="btn btn--secondary btn-start-over"> Start over </button>
<button class="btn btn--success btn-download" onClick={downloadCollage}> Download </button>
<button class="btn btn--primary btn-create-collage"> Vytvořit koláž </button>
<button class="btn btn--secondary btn-start-over"> Spustit </button>
<button class="btn btn--success btn-download" onClick={downloadCollage}> Stáhnout </button>
</div>
<div class="previewContainer">
<div class="spinnerContainer spinnerContainer--hidden">