This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<form id="todoInput"> | |
<input type="text" name="todo"></input> | |
<button type="submit">submit</button> | |
</form> | |
<ul id="todoList"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Batching { | |
// ... | |
async scheduleUpdate() { | |
if(!this.updateRequested) { | |
this.updateRequested = true; | |
this.updateRequested = await false; | |
this.update(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Batching { | |
/** | |
* We declare and initialize a variable to keep track of whether | |
* or not an update has already been requested | |
*/ | |
updateRequested = false; | |
scheduleUpdate() { | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(1); | |
Promise.resolve().then(() => { | |
console.log(2); | |
}); | |
console.log(3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyElement extends LitElement { | |
foo() { | |
this.myPropertyA = 1; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener('install', event => { | |
// cache a cat SVG | |
event.waitUntil( | |
caches.open('static-v1') | |
.then(cache => cache.add('cat.svg')) | |
); | |
}); | |
self.addEventListener('activate', event => { | |
clients.claim(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener('install', event => { | |
// cache a cat SVG | |
event.waitUntil( | |
caches.open('static-v1') | |
.then(cache => cache.add('cat.svg')) | |
); | |
}); | |
self.addEventListener('activate', event => { | |
clients.claim(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener('install', event => { | |
// cache a cat SVG | |
event.waitUntil( | |
caches.open('static-v1') | |
.then(cache => cache.add('cat.svg')) | |
); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if ('serviceWorker' in navigator) { | |
window.addEventListener('load', () => { | |
navigator.serviceWorker.register('./sw.js'); | |
}); | |
} | |
setTimeout(() => { | |
const img = new Image(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if ('serviceWorker' in navigator) { | |
window.addEventListener('load', () => { | |
navigator.serviceWorker.register('./sw.js'); | |
}); | |
} | |
// ... |