Chaplin, KinectJS, Inject, Minion

Alex R. Young





oo commonjs modules backbone.js kinect

Chaplin, KinectJS, Inject, Minion

Posted by Alex R. Young on .

oo commonjs modules backbone.js kinect

Chaplin, KinectJS, Inject, Minion

Posted by Alex R. Young on .


Chaplin (License: MIT) from Moviepilot and 9elements is an example architecture using Backbone.js. It features lazy loading through RequireJS, module inter-communication using the mediator and publish/subscribe patterns, controllers for managing UI views, Rails-style routes, and strict memory management and object disposal.

While developing web applications like moviepilot.com and salon.io, we felt the need for conventions on how to structure Backbone applications. While Backbone is fine [...], it's not a framework for single-page applications.

All Chaplin needs is a web server to serve the client-side code. The example app, "Facebook Likes Browser", even includes client-side OAuth 2.0, thereby demonstrating client-side authentication.


KinectJS (License: MIT) aims to bring Kinect controls to HTML5. The author has created some KinectJS demos and KinectJS YouTube videos, so with the required hardware it should be possible to try it out.

The client-side JavaScript is only one part of the implementation -- the other is an Adobe AIR application that provides the bridge to the Kinect drivers. The AIR application isn't currently open source, but the JavaScript code is MIT licensed.


Inject (License: Apache 2.0, GitHub: linkedin / inject) from LinkedIn is a library agnostic dependency manager. It adds CommonJS support to the browser, and the authors have created a Inject/CommonJS compatibility document to show what exactly is supported. Resources can be loaded cross-domain, and the AMD API is also supported. Inject also has a lot of unit tests, written with QUnit.

Once Inject is loaded, it'll find and load dependencies automatically:

<script type="text/javascript" src="/js/inject.js"></script>  
<script type="text/javascript">  

Now if program.js looked liked this:

var hello = require('hello').hello;  

Then Inject will load the hello module.

Inject finds the dependencies automatically and loads them asynchronously. If a developer changes some downstream dependency - for example, changes hello.js to depend on new-name-module.js instead of name.js - your code will keep working because Inject will automatically find and download the new dependencies on the next page load.


MinionJS (License: MIT/X11, npm: minion) by Taka Kojima is a small library that provides classical inheritance for Node and browsers:

minion.require('example.Example', function(Example) {  
  var instance = new Example();

Minion also includes a publish/subscribe implementation. All classes have subscribe and publish methods which can be used to bind callbacks to notifications.

Finally, Minion has a build script that can be used to package classes for client-side deployment.