Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

neuon

felixtran6MIT1.0.9TypeScript support: included

Wrapper web-component for polymer/lit-element

readme

Neuon

Wrapper web-component for polymer/lit-element

Visit https://lit-element.polymer-project.org/

Usage

import Neuon from 'neuon'

@Neuon.define('my-element')
class MyElement extends Neuon.Element{
    @Neuon.prop title = 'this is a title'

    static get styles(){
        return Neuon.css`
            :host:{
                display: block;
            }
            div {
                color: red;
            }
        `
    }

    constructor(){
        super()
    }

    template(){
        return Neuon.html`
            <div>${this.title}</div>
        `
    }
}

Neuon.Element

  • addCustomEvent(name, detail)

    document.querySelector('my-element').addCustomEvent('offseting', { x: 10, y: 10})
  • on(name, callback)

    document.querySelector('my-element').on('offseting', (e) => console.log(e.detail)) 
    // {x:10 y:10}
  • dispatch(name, detail)
    document.querySelector('my-element').dispatch('offseting', {x: 10, y: 20})