[IMP] rename openerp.base.Class.mix to openerp.base.Class.include, // to Ruby's name for the same behavior
bzr revid: xmo@openerp.com-20110808095750-yhg1ixaump4rq09x
This commit is contained in:
parent
2f94a513bd
commit
f130d1c374
|
@ -56,7 +56,7 @@ openerp.base.core = function(openerp) {
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
Class.mix = function (properties) {
|
Class.include = function (properties) {
|
||||||
for (var name in properties) {
|
for (var name in properties) {
|
||||||
if (typeof properties[name] !== 'function'
|
if (typeof properties[name] !== 'function'
|
||||||
|| !fnTest.test(properties[name])) {
|
|| !fnTest.test(properties[name])) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ $(document).ready(function () {
|
||||||
},
|
},
|
||||||
bar: 3
|
bar: 3
|
||||||
});
|
});
|
||||||
C0.mix({
|
C0.include({
|
||||||
foo: function () {
|
foo: function () {
|
||||||
return 5;
|
return 5;
|
||||||
},
|
},
|
||||||
|
@ -94,7 +94,7 @@ $(document).ready(function () {
|
||||||
strictEqual(new C1().foo(), 2);
|
strictEqual(new C1().foo(), 2);
|
||||||
strictEqual(new C1().bar(), 1);
|
strictEqual(new C1().bar(), 1);
|
||||||
|
|
||||||
C1.mix({
|
C1.include({
|
||||||
foo: function () { return 2 + this._super(); },
|
foo: function () { return 2 + this._super(); },
|
||||||
bar: function () { return 1 + this._super(); }
|
bar: function () { return 1 + this._super(); }
|
||||||
});
|
});
|
||||||
|
@ -110,7 +110,7 @@ $(document).ready(function () {
|
||||||
strictEqual(instance.foo(), 1);
|
strictEqual(instance.foo(), 1);
|
||||||
strictEqual(instance.bar(), 1);
|
strictEqual(instance.bar(), 1);
|
||||||
|
|
||||||
C0.mix({
|
C0.include({
|
||||||
foo: function () { return 2; },
|
foo: function () { return 2; },
|
||||||
bar: function () { return 2 + this._super(); }
|
bar: function () { return 2 + this._super(); }
|
||||||
});
|
});
|
||||||
|
@ -128,7 +128,7 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
var instance = new C1();
|
var instance = new C1();
|
||||||
strictEqual(instance.foo(), 2);
|
strictEqual(instance.foo(), 2);
|
||||||
C0.mix({
|
C0.include({
|
||||||
foo: function () { return 2; },
|
foo: function () { return 2; },
|
||||||
bar: function () { return 2 + this._super(); }
|
bar: function () { return 2 + this._super(); }
|
||||||
});
|
});
|
||||||
|
|
|
@ -88,7 +88,7 @@ initializing the addon.
|
||||||
/** @namespace */
|
/** @namespace */
|
||||||
openerp.example = function (openerp) {
|
openerp.example = function (openerp) {
|
||||||
// basic initialization code (e.g. templates loading)
|
// basic initialization code (e.g. templates loading)
|
||||||
openerp.example.SomeClass = Class.extend(
|
openerp.example.SomeClass = openerp.base.Class.extend(
|
||||||
/** @lends openerp.example.SomeClass# */{
|
/** @lends openerp.example.SomeClass# */{
|
||||||
/**
|
/**
|
||||||
* Description for SomeClass's constructor here
|
* Description for SomeClass's constructor here
|
||||||
|
|
Loading…
Reference in New Issue