Sha256: 1e73ede32e2e50e036fda13adfa3216d56c6a0573edf338078d4612b1a7738f7

Contents?: true

Size: 917 Bytes

Versions: 4

Compression:

Stored size: 917 Bytes

Contents

/**
 * class Jax.Helper
 *
 * Jax Helpers are glorified mixins. They contain a set of methods which can then be
 * included into any Jax class.
 *
 * Defining a helper is easy, and looks a bit like this:
 *
 *     var HelloHelper = Jax.Helper.create({
 *       sayHi: function(name) { alert("Hello, "+name+"!"); }
 *     });
 *
 * Once defined, using helpers is particularly simple. In any Jax class, simply define
 * a +helpers+ function that returns an array of helpers:
 *
 *     var Liaison = Jax.Class.create({
 *       helpers: function() { return [HelloHelper]; }
 *     });
 *
 * Now the +Liaison+ class will include the +sayHi+ method which can be called just like
 * any other method:
 *
 *     var l = new Liaison();
 *     l.sayHi("World");
 *     //=> Hello, World!
 *
 **/
Jax.Helper = {
  instances: [],

  create: function(methods) {
    Jax.Helper.instances.push(methods);
    return methods;
  }
};

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jax-0.0.0.9 src/jax/mvc/helper.js
jax-0.0.0.8 src/jax/mvc/helper.js
jax-0.0.0.7 src/jax/mvc/helper.js
jax-0.0.0.6 src/jax/mvc/helper.js