mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -07:00
Use JS classes for Template and Entity
`Template` and `Entity` used a costum form of inheritance. Refs: #6285
This commit is contained in:
parent
f9de339f85
commit
327e70ea82
2 changed files with 251 additions and 273 deletions
|
|
@ -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
Loading…
Reference in a new issue