Re: [w3c/webcomponents] Constructor arguments in custom elements (#605)

I found a kinda `dirty` workaround of wrapping the custom elements class in a constructor function where I can do DI and capturing the constructor function arguments in closure and passing them to the inner class(custom elements class)

Here is a simple sudo code of what I mean
```javascript
// I do DI of the dependencies here
function MyComponent(http, bar) {
    return class extends HTMLElement {
        constructor() {
            super()
            this.http = http
            this.bar = bar
    }
   }
}
```
For a working version of code, refer https://github.com/ibhi/webcomponent-with-di/blob/master/src/users.component.js

-- 
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/605#issuecomment-307186960

Received on Thursday, 8 June 2017 18:25:41 UTC