Skip to content

Commit 361aba1

Browse files
authored
Merge pull request #215 from otmon76/1.14.7
1.14.7
2 parents cd11b15 + 2c14b6b commit 361aba1

File tree

9 files changed

+1920
-533
lines changed

9 files changed

+1920
-533
lines changed

1-js/99-js-misc/07-weakref-finalizationregistry/article.md

Lines changed: 209 additions & 240 deletions
Large diffs are not rendered by default.

1-js/99-js-misc/07-weakref-finalizationregistry/weakref-dom.view/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
<body>
1111

1212
<div class="app">
13-
<button class="start-messages">Start sending messages</button>
13+
<button class="start-messages">Začít posílat zprávy</button>
1414
<div class="window">
1515
<div class="window__header">
16-
<p class="window__title">Messages:</p>
17-
<button class="window__button">Close</button>
16+
<p class="window__title">Zprávy:</p>
17+
<button class="window__button">Zavřít</button>
1818
</div>
1919
<div class="window__body">
20-
No messages.
20+
Žádné zprávy.
2121
</div>
2222
</div>
2323
</div>
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
const startMessagesBtn = document.querySelector('.start-messages'); // (1)
2-
const closeWindowBtn = document.querySelector('.window__button'); // (2)
3-
const windowElementRef = new WeakRef(document.querySelector(".window__body")); // (3)
1+
const tlačítkoZačítPosílat = document.querySelector('.start-messages'); // (1)
2+
const tlačítkoZavřítOkno = document.querySelector('.window__button'); // (2)
3+
const odkazNaElementOkna = new WeakRef(document.querySelector(".window__body")); // (3)
44

5-
startMessagesBtn.addEventListener('click', () => { // (4)
6-
startMessages(windowElementRef);
7-
startMessagesBtn.disabled = true;
5+
tlačítkoZačítPosílat.addEventListener('click', () => { // (4)
6+
startMessages(odkazNaElementOkna);
7+
tlačítkoZačítPosílat.disabled = true;
88
});
99

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

1212

13-
const startMessages = (element) => {
14-
const timerId = setInterval(() => { // (6)
13+
const začniPosílatZprávy = (element) => {
14+
const idČasovače = setInterval(() => { // (6)
1515
if (element.deref()) { // (7)
16-
const payload = document.createElement("p");
17-
payload.textContent = `Message: System status OK: ${new Date().toLocaleTimeString()}`;
18-
element.deref().append(payload);
16+
const zátěž = document.createElement("p");
17+
zátěž.textContent = `Zpráva: Stav systému OK: ${new Date().toLocaleTimeString()}`;
18+
element.deref().append(zátěž);
1919
} else { // (8)
20-
alert("The element has been deleted."); // (9)
21-
clearInterval(timerId);
20+
alert("Element byl odstraněn."); // (9)
21+
clearInterval(idČasovače);
2222
}
2323
}, 1000);
2424
};
Lines changed: 177 additions & 26 deletions
Loading

0 commit comments

Comments
 (0)