Re: [WICG/webcomponents] Provide a mechanism to prevent or coalesce upgrades when defining new custom elements (#922)

In previous scoped custom element registry proposals we briefly had a batch definition API, like:

```ts
customElements.defineMultiple({
  'my-element-1': MyElement1,
  'my-element-2': MyElement2,
});
```

That clearly allows for batching, but might not be general enough if there's not a single point where definitions can be made as is typical for using the current global registry. It might be sufficient for scoped registries though.

A disable/enable API might work:

```ts
customElements.disableUpgrades();
// ...
customElements.enableUpgrades();
```

Though due to module import ordering, disabling will need to happen before importing self-registering elements, so using it won't always be so straight-forward:

```ts
import './disable-upgrades.js';
import './app.js';
customElements.enableUpgrades();
```

-- 
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/922#issuecomment-821551764

Received on Friday, 16 April 2021 20:41:30 UTC