Package Exports
- neowidget
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (neowidget) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Virtual DOM based Widget for Neon.js
Requirements
NeoWidget uses JSX to define DOM Trees, so you will need jsx-transform-loader for webpack or something based on jsx-transform.
Usage:
npm install -save neowidgetWebpack Example
webpack.config.js
{..., loader: 'jsx-transform-loader'}You need to specify the @docblock in the files where you use JSX: /** @jsx NeoWidget.h */
/** @jsx NeoWidget.h */
var Heading = Class('Heading').inherits(NeoWidget)({
state : {
title : 'Heading Title'
}
build : function() {
return <div>
<h2>{this.state.title}</h2>
</div>
}
});
Class('Button').inherits(NeoWidget)({
prototype : {
state : {
title : 'Click Me!',
count : 0
},
build : function() {
return <div>
{new <Heading />.vDom}
<button onclick={this.clickHandler.bind(this)}>{this.state.title}</button>
<p>{'Clicks: ' + this.state.count}</p>
</div>
},
clickHandler : function() {
this.state.count++
this.update(this.state);
}
}
});
var widget = new Button()
widget.render(document.body);