- From: Joe Pea <notifications@github.com>
- Date: Wed, 21 Feb 2018 20:40:13 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 22 February 2018 04:40:51 UTC
In the following example, a shadow root is not required, and the states not modifiable from outside: ```js // if this feature is out after builtin modules, then something like import { ElementStates } from ':system' // otherwise const { ElementStates } = window import Privates from './privates-helper' const _ = new Privates import glUtils from './glUtils' class GlSphere extends HTMLElement { constructor() { super() _(this).states = new ElementStates( this ) // hooks into the HTML engine } connectedCallback() { glUtils.whenMouseEnter(this, () => { _(this).states.add('hover') // ... check for CSS custom properties and update the WebGL scene ... }) glUtils.whenMouseLeave(this, () => { _(this).states.remove('hover') // ... check for CSS custom properties and update the WebGL scene ... }) } disconnectedCallback() { _(this).states.destroy() // so `this` can be GC'ed } } customElements.define('gl-sphere', GlSphere) ``` -- 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/738#issuecomment-367565438
Received on Thursday, 22 February 2018 04:40:51 UTC