widgetjs is a framework that provides routing, events and stateful widgets to JS Apps.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
docs/docco
sample
src
.editorconfig
.eslintrc.js
.gitignore
.jshintrc
.tern-project
.travis.yml
LICENSE
README.md
bower.json
config.js
gulpfile.js
karma.conf.js
package.json

README.md

widgetjs Travis CI Status

Widget-JS is a framework that provides routing, events and widgets to javascript apps.

A simple widget can look like:

var counterWidget = function() {
	var that = widgetjs.widget();

	var count = 0;

	that.renderContentOn = function(html) {
		html.h1(count.toString());
		html.button("+").click(function() { count++; that.update();});
		html.button("-").click(function() { count--; that.update();});
	};

	return that;
};

See the complete example https://github.com/foretagsplatsen/widget-js/blob/master/sample/counterWidget/index.html

Install

Install using bower

bower install widgetjs

Alternatively

Download the minified version or the complete project as a zip

Usage

Include the minified version in your project:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="WidgetJS.min.js"></script>

Use with requirejs:

requirejs.config({
	baseUrl: ".",
	paths: {
		"widgetjs" : "<widget js path>/src/WidgetJS.min.js"
	}
});

or

requirejs.config({
	baseUrl: ".",
	paths: {
		"widgetjs" : "<widget js path>/src/"
	}
});

CODE

You need npm, bower and grunt

Install depedencies

bower install
npm install

Lint + run tests :

grunt

Build:

grunt dist

Credits

Thanks a ton to @NicolasPetton for HtmlCanvas and tricking us into developing and using Widget-JS at Företagsplatsen

License

Widget-JS is under the MIT-license, see file LICENSE