- From: Jan Miksovsky <notifications@github.com>
- Date: Wed, 16 Mar 2016 15:48:19 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/445@github.com>
Following up on issue #431, I'd like to propose that window.customElements allow a dev to retrieve information about the custom elements which have been registered. It sounds like @domenic was supportive of this idea, so as a strawman, I propose adding the following: * `window.customElements.get(name)`. Returns the class which was previously registered with `define(name)`, or `undefined` if no element has yet been registered with that name. * `window.customElements[@@iterator]()`. This returns a new `Iterator` object that enumerates the `[name, class]` pairs registered. I don't particularly care in what order the entries are returned. For consistency with `Map.prototype[@@iterator]()`, it would be nice to return these in the order in which they were defined. This, at least would meet the needs I've encountered, chiefly being able to: 1) easily verify that a particular custom element has in fact been registered, 2) conditionally define an element if it hasn't already been registered. E.g.: if (!window.customElements.get('my-element')) { window.customElements.define('my-element', MyElement); } --- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/issues/445
Received on Wednesday, 16 March 2016 22:49:07 UTC