mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-26 12:31:28 +00:00
Use JS classes for Template and Entity
`Template` and `Entity` used a costum form of inheritance. Refs: #6285
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Provides a nicer syntax for defining classes,
|
||||
* with support for OO-style inheritance.
|
||||
*/
|
||||
export function Class(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;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user