Refactor
This commit is contained in:
parent
1ce961d6c2
commit
99cdb62928
1 changed files with 338 additions and 431 deletions
17
shared/src/serialization/serializable.ts
Normal file
17
shared/src/serialization/serializable.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { mangledTypeKey } from './mangled-type-key';
|
||||
import { SerializableClass } from './serializable-class';
|
||||
import { serializableMapping } from './serializable-mapping';
|
||||
|
||||
export const serializable = (type: SerializableClass): any => {
|
||||
if (!serializableMapping.get(type.name)) {
|
||||
serializableMapping.set(type.name, {
|
||||
constructor: type,
|
||||
overridden: false,
|
||||
});
|
||||
}
|
||||
|
||||
Object.defineProperty(type, mangledTypeKey, { value: type.name });
|
||||
Object.defineProperty(type.prototype, mangledTypeKey, { value: type.name });
|
||||
|
||||
return type;
|
||||
};
|
||||
Loading…
Reference in a new issue