npm install app-decorators --save
npm install babel-preset-es2015 babel-preset-app-decorators --save-dev
.babelrc
{
"presets": ["es2015", "app-decorators"]
}
System.config({
map : {
"app-decorators": "node_modules/app-decorators/src/app-decorators",
}
});
import { component, view, on } from 'app-decorators';
@component() // make sure @component is the first component
@view(`
<h3>{{head}}</h3>
<div>{{count}}</div>
<div>
<span class="up"> + </span>
<span class="down"> - </span>
</div>
`)
class Item {
@view.bind count = 0;
@on('click .up') onClickUp() {
++this.count
}
@on('click .down') onClickUp() {
--this.count
}
}
export {
Item
}
let item = Item.create({
head: 'Some Head'
});
document.body.appendChild(item);
// or
<!DOCTYPE html>
<html lang="en">
<head>
<title>my com-item</title>
</head>
<body>
<com-item></com-item>
</body>
</html>
- @component
- @view
- @on
- @action
- [@style] : in progress
- [@model] : in progress
- Router
- Customelement
- Eventhandler
- View
- Model : in progress
make install
make compile
make test
(c) 2015 - 2016 Serkan Sipahi App-Decorators may be freely distributed under the MIT license.