PolymerLabs/async-dom

Name: async-dom

Owner: PolymerLabs

Description: Async DOM APIs

Created: 2016-03-11 22:12:55.0

Updated: 2018-01-19 17:07:42.0

Pushed: 2016-03-11 22:14:09.0

Homepage: null

Size: 2

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

async-dom

APIs for reading and writing DOM asynchronously.

Overview

async-dom solve two related problems:

API
Element.readAsync(nextFrame : boolean) : Promise

Returns a Promise that resolves during the next DOM read phase.

In strict mode, layout flushing API calls to the element are allowed in tasks, but mutations are disallowed.

Element.writeAsync(nextFrame : boolean) : Promise

Returns a Promise that resolves during the next DOM write phase.

In strict mode, layout flushing API calls to the element are disallowed in tasks, but mutations are allowed.

Element.waitFor(promise : Promise, options)

Defers resolution of any subsequently requested DOM promises until after argument has completed.

Because containers by default depend on the layout of their descendants, waitFor() bubbles up the tree, blocking subsequent DOM promises for all ancestor elements as well, but not for descendent or sibling elements.

Bubbling of waitFor() stops if an element is strictly contained (not implemented): https://drafts.csswg.org/css-containment/

Element.enableStrictDom() (Not Implemented)

Enables and disables strict mode, which prohibits some API calls outside of tasks.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.