diff options
Diffstat (limited to 'chromium/third_party/catapult/third_party/polymer2/bower_components/polymer/types/lib/utils/flattened-nodes-observer.d.ts')
-rw-r--r-- | chromium/third_party/catapult/third_party/polymer2/bower_components/polymer/types/lib/utils/flattened-nodes-observer.d.ts | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/chromium/third_party/catapult/third_party/polymer2/bower_components/polymer/types/lib/utils/flattened-nodes-observer.d.ts b/chromium/third_party/catapult/third_party/polymer2/bower_components/polymer/types/lib/utils/flattened-nodes-observer.d.ts new file mode 100644 index 00000000000..32915b4bd35 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer2/bower_components/polymer/types/lib/utils/flattened-nodes-observer.d.ts @@ -0,0 +1,96 @@ +/** + * DO NOT EDIT + * + * This file was automatically generated by + * https://github.com/Polymer/gen-typescript-declarations + * + * To modify these typings, edit the source file(s): + * lib/utils/flattened-nodes-observer.html + */ + +/// <reference path="boot.d.ts" /> +/// <reference path="array-splice.d.ts" /> +/// <reference path="async.d.ts" /> + +declare namespace Polymer { + + /** + * Class that listens for changes (additions or removals) to + * "flattened nodes" on a given `node`. The list of flattened nodes consists + * of a node's children and, for any children that are `<slot>` elements, + * the expanded flattened list of `assignedNodes`. + * For example, if the observed node has children `<a></a><slot></slot><b></b>` + * and the `<slot>` has one `<div>` assigned to it, then the flattened + * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other + * `<slot>` elements assigned to it, these are flattened as well. + * + * The provided `callback` is called whenever any change to this list + * of flattened nodes occurs, where an addition or removal of a node is + * considered a change. The `callback` is called with one argument, an object + * containing an array of any `addedNodes` and `removedNodes`. + * + * Note: the callback is called asynchronous to any changes + * at a microtask checkpoint. This is because observation is performed using + * `MutationObserver` and the `<slot>` element's `slotchange` event which + * are asynchronous. + * + * An example: + * ```js + * class TestSelfObserve extends Polymer.Element { + * static get is() { return 'test-self-observe';} + * connectedCallback() { + * super.connectedCallback(); + * this._observer = new Polymer.FlattenedNodesObserver(this, (info) => { + * this.info = info; + * }); + * } + * disconnectedCallback() { + * super.disconnectedCallback(); + * this._observer.disconnect(); + * } + * } + * customElements.define(TestSelfObserve.is, TestSelfObserve); + * ``` + */ + class FlattenedNodesObserver { + + /** + * Returns the list of flattened nodes for the given `node`. + * This list consists of a node's children and, for any children + * that are `<slot>` elements, the expanded flattened list of `assignedNodes`. + * For example, if the observed node has children `<a></a><slot></slot><b></b>` + * and the `<slot>` has one `<div>` assigned to it, then the flattened + * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other + * `<slot>` elements assigned to it, these are flattened as well. + * + * @param node The node for which to return the list of flattened nodes. + * @returns The list of flattened nodes for the given `node`. + */ + static getFlattenedNodes(node: HTMLElement|HTMLSlotElement|null): any[]|null; + + /** + * Activates an observer. This method is automatically called when + * a `FlattenedNodesObserver` is created. It should only be called to + * re-activate an observer that has been deactivated via the `disconnect` method. + */ + connect(): void; + + /** + * Deactivates the flattened nodes observer. After calling this method + * the observer callback will not be called when changes to flattened nodes + * occur. The `connect` method may be subsequently called to reactivate + * the observer. + */ + disconnect(): void; + + /** + * Flushes the observer causing any pending changes to be immediately + * delivered the observer callback. By default these changes are delivered + * asynchronously at the next microtask checkpoint. + * + * @returns Returns true if any pending changes caused the observer + * callback to run. + */ + flush(): boolean; + } +} |