Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from vmpstr/move-from-async-dom
Browse files Browse the repository at this point in the history
Moving items from async-dom
  • Loading branch information
vmpstr authored Jul 24, 2018
2 parents 1f1c607 + 2f252c8 commit 41c38be
Show file tree
Hide file tree
Showing 7 changed files with 654 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@

This repo is a collection of documents, sample code, and discussions surrounding
the Display Locking proposal.

- [Display Locking
explainer](https://github.com/chrishtr/display-locking/blob/master/explainer.md)
- [Sample
code](https://github.com/chrishtr/display-locking/blob/master/sample-code)
614 changes: 614 additions & 0 deletions explainer.md

Large diffs are not rendered by default.

Binary file added resources/spinner_jank.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/spinner_without_jank_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/spinner_without_jank_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/spinner_without_jank_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions sample-code/basic_usage.html
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>

0 comments on commit 41c38be

Please sign in to comment.