forked from mirrors/0ad
a9987868c4
Manual fixes needed for: eslint --no-config-lookup --rule '"no-use-before-define": ["error", "nofunc"] Ref: #7812 Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
27 lines
405 B
JavaScript
27 lines
405 B
JavaScript
API3 = function(m)
|
|
{
|
|
/**
|
|
* Provides a nicer syntax for defining classes,
|
|
* with support for OO-style inheritance.
|
|
*/
|
|
m.Class = function(data)
|
|
{
|
|
let ctor;
|
|
if (data._init)
|
|
ctor = data._init;
|
|
else
|
|
ctor = function() { };
|
|
|
|
if (data._super)
|
|
ctor.prototype = { "__proto__": data._super.prototype };
|
|
|
|
for (const key in data)
|
|
ctor.prototype[key] = data[key];
|
|
|
|
return ctor;
|
|
};
|
|
|
|
return m;
|
|
|
|
}(API3);
|