Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 806 Bytes

on.md

File metadata and controls

44 lines (36 loc) · 806 Bytes

@on

import { component, view, on } from 'app-decorators';

@view(`
    <div class="add">add</div>
    <div class="edit">edit</div>
    <div class="delete">delete</div>
`)

@component()
class Item {

    @on('click .add') addItem( event ){
        console.log('on click .add');
    }
    @on('click .edit') editItem( event ){
        console.log('on click .edit');
    }
    @on('click .delete') deleteItem( event ){
        console.log('on click .add');
    }

    // bind global events
    @on('resize', window) onResize(event){

    }

}

let item = Item.create();
document.body.appendChild(item);
<body>
    <!-- output -->
    <com-item>
        <div class="add">add</div>
        <div class="edit">edit</div>
        <div class="delete">delete</div>
    </com-item>
</body>