From b5186c5dc0eedeb493b3b91aade5a0d06c2d7a19 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 26 Mar 2012 14:10:38 +0200 Subject: [PATCH] [imp] added some doc to novajs bzr revid: nicolas.vanhoren@openerp.com-20120326121038-p1n7p8lu7vylop1v --- addons/web/static/lib/novajs/src/nova.js | 39 +++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/addons/web/static/lib/novajs/src/nova.js b/addons/web/static/lib/novajs/src/nova.js index 337ba151595..30071c280ad 100644 --- a/addons/web/static/lib/novajs/src/nova.js +++ b/addons/web/static/lib/novajs/src/nova.js @@ -28,7 +28,44 @@ nova = (function() { lib.internal = {}; /* - * (Almost) unmodified John Resig's inheritance + * (Almost) unmodified John Resig's inheritance. + * + * Defines The Class object. That object can be used to define and inherit classes using + * the extend() method. + * + * Example: + * + * var Person = nova.Class.extend({ + * init: function(isDancing){ + * this.dancing = isDancing; + * }, + * dance: function(){ + * return this.dancing; + * } + * }); + * + * The init() method act as a constructor. This class can be instancied this way: + * + * var person = new Person(true); + * person.dance(); + * + * The Person class can also be extended again: + * + * var Ninja = Person.extend({ + * init: function(){ + * this._super( false ); + * }, + * dance: function(){ + * // Call the inherited version of dance() + * return this._super(); + * }, + * swingSword: function(){ + * return true; + * } + * }); + * + * When extending a class, each re-defined method can use this._super() to call the previous + * implementation of that method. */ /* Simple JavaScript Inheritance * By John Resig http://ejohn.org/