DailyJS

Caress, cjs2web, zoe.js

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

libraries oo touch commonjs

Caress, cjs2web, zoe.js

Posted by Alex R. Young on .
Featured

libraries oo touch commonjs

Caress, cjs2web, zoe.js

Posted by Alex R. Young on .

Caress

Caress (GitHub: ekryski / caress-server, License: MIT, npm: caress-server) by Eric Kryski converts TUIO events to browser events (W3C Touch Events version 2), allowing desktop browsers to be driven by multitouch devices. This includes Apple's Magic Trackpad, Android, and iOS devices.

Caress uses Node and Socket.IO to send TUIO messages to the browser -- this is usually done using UDP, but Node and Socket.IO seem to work well. Since Caress can be used with the Magic Trackpad, it might work well as a shortcut for testing touch-based interfaces during development.

cjs2web

cjs2web (GitHub: cjs2web, License: MIT, npm: cjs2web) by Alex Lawrence is a CommonJS module-to-browser translation tool. It currently supports mapping local modules, and the exports object (including module.exports). It doesn't support Node's process and global modules, so it's useful for lightweight porting of browser-friendly code. This is in contrast to something like OneJS that actually aims to create a Node-like environment in the browser.

Jasmine specs are included, and the Grunt build script used to run them.

zoe.js

zoe.js (GitHub: zestjs / zoe, License: MIT, npm: zoe, component: zestjs/zoe) by Guy Bedford is a Node/AMD/browser library for working with multiple inheritance:

The basic principle is that inheritance is a form of object extension. A core object is extended with a number of implemented definitions. When that object is extended, a new object is created implementing the core definitions as well as any new definitions. This is the inheritance system of zoe.create.

Objects created this way can be configured with "function chains", which allows the library to support asynchronous code and various forms of the observer pattern.

Basic object extension uses zoe.create:

var baseClass = {  
  hello: 'world'
};

var derivedClass = zoe.create([baseClass], {  
  another: 'property'
});

If an _extend property is supplied, zoe will use it to apply various rules. In this example, chaining is used which will cause both greet methods to run:

var greetClass = {  
  _extend: {
    greet: 'CHAIN'
  },
  greet: function() {
    return 'howdy';
  }
};

var myClass = zoe.create([greetClass], {  
  greet: function() {
    alert('greeting');
  }
});

myClass.greet();