mirror of
https://github.com/Febbweiss/sis.git
synced 2026-03-04 22:25:35 +00:00
25 lines
824 B
JavaScript
25 lines
824 B
JavaScript
function heriter(destination, source) {
|
|
function initClassIfNecessary(obj) {
|
|
if( typeof obj["_super"] == "undefined" ) {
|
|
obj["_super"] = function() {
|
|
var methodName = arguments[0];
|
|
var parameters = arguments[1];
|
|
return this["__parent_methods"][methodName].apply(this, parameters);
|
|
}
|
|
}
|
|
|
|
if( typeof obj["__parent_methods"] == "undefined" ) {
|
|
obj["__parent_methods"] = {};
|
|
}
|
|
}
|
|
|
|
for (var element in source) {
|
|
if( typeof destination[element] != "undefined" ) {
|
|
initClassIfNecessary(destination);
|
|
destination["__parent_methods"][element] = source[element];
|
|
} else {
|
|
destination[element] = source[element];
|
|
}
|
|
}
|
|
}
|