This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from vmpstr/move-from-async-dom
Moving items from async-dom
- Loading branch information
Showing
7 changed files
with
654 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
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.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!doctype HTML> | ||
|
||
<style> | ||
#lockable { | ||
width: 200px; | ||
height: 50px; | ||
contain: paint; | ||
background-color: lightblue; | ||
} | ||
</style> | ||
|
||
<div id="lockable"></div> | ||
|
||
<script> | ||
async function updateLockable() { | ||
let element = document.getElementById("lockable"); | ||
|
||
// Get the lock if the user-agent supports getDisplayLock. | ||
let lock = element.getDisplayLock ? element.getDisplayLock() : undefined; | ||
// Await lock acquisition. | ||
if (lock) | ||
await lock.acquire(); | ||
|
||
// Update the contents of a locked element. | ||
element.innerText = "Lorem ipsum."; | ||
|
||
// Commit. We don't need to await the resolution, since we don't need to do | ||
// anything when the promise resolves. | ||
if (lock) | ||
lock.commit(); | ||
} | ||
|
||
window.onload = updateLockable; | ||
</script> | ||
|