Re: [css-houdini-drafts] [css-paint-api] Use JS export instead of registerPaint

Let me show some examples with error handling to see if it makes sense. I've added an example from Animation worklets too.

```js
// my-houdini-definitions.js
export const foo = 'bar';
export const baz = ''

export class rainbow {
  paint() {}
}

export class parallax {
  animate() {}
}
```

```html
<script>
window.animationWorklet.addModule('my-houdini-definitions.js').then(() => {
    new WorkletAnimation('parallax', effects) // OK
    new WorkletAnimation('raindow', effects) // Throws
    new WorkletAnimation('foo', effects) // Throws
})

CSS.paintWorklet.addModule('my-houdini-definitions.js')
</script>

<style>
body {
    background: red;
    background: paint('rainbow'); /* Rainbow background */
}
body {
    background: red;
    background: paint('parallax'); /* Red background and logs an error in dev tools */
}
body {
    background: red;
    background: paint('foo'); /* Red background and logs an error in dev tools */
}

body {
    background: red;
    background: paint('unregistered') /* Red background and logs nothing because it might be registered later */
}
/* baz is exported but unused so nothing is logged for it either */
</style>
```

-- 
GitHub Notification of comment by rik
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/564#issuecomment-359291074 using your GitHub account

Received on Sunday, 21 January 2018 23:24:42 UTC