app-decorators-element-to-function

babel plugin for app-decorators to extends an HTMLElement in IE and Safari

Usage no npm install needed!

<script type="module">
  import appDecoratorsElementToFunction from 'https://cdn.skypack.dev/app-decorators-element-to-function';
</script>

README

app-decorators-element-to-function

Dependency Status devDependency Status

Installation

$ npm install app-decorators-element-to-function --save

Usage

The goal of this babel-plugin is for app-decorators @component:

see: https://github.com/babel/babel/issues/1548

app-decorators-element-to-function.js:

let elementToFunction = Element => {
    if(typeof Element === 'function'){
        return Element;
    }

    let _Element = function(){};
    _Element.prototype = Element.prototype;
    return _Element;

};
import ElementToFunc from 'app-decorators-element-to-function';
class Foo extends ElementToFunc(HTMLImageElement) {
    
}