Re: [WICG/webcomponents] `CustomElementRegistry.define()` should return the new custom element (#927)

@domenic you are right -- I misunderstood that Text would be the same returned value as the argument passed in.

In any case, it would be nice if there was some kind of `getOrSet` API here. If a custom element is already defined, and if I don't want an error to be thrown, I have to wrap a `customElements.define()` call in a `try/catch`. I can also call `customElements.get()` first to see if that gets anything, and if it doesn't, then call `define()`.

This is similar to the TC39 emplace proposal, which also lists some similar APIs in other languages: https://github.com/tc39/proposal-upsert

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/927#issuecomment-849151574

Received on Wednesday, 26 May 2021 22:05:55 UTC