Re: [w3c/webcomponents] How to define APIs only for custom element authors (#758)

@alice An example of **option 5** for element semantics would be like

```js
// ...
const {withSemantics} = customElements.elementFeatures

class MyEl extends withSemantics( HTMLElement ) {
  // ...
  receiveSemantics( semantics ) {
    const privates = elementPrivates.get(this);
    privates.semantics = semantics;
  }
}

customElements.define('my-el', MyEl)
```

where in this example, the `receiveSemantics` callback will be called by the `withSemantics` mixin implementation. So `receiveSemantics` (or whatever it will be called) should only be defined on classes that have an application of the `withSemantics` mixin.

-- 
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/758#issuecomment-417939788

Received on Sunday, 2 September 2018 15:46:33 UTC