aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/SerializationHelper.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-07-30 09:41:08 -0400
committerbob <bcz@cs.brown.edu>2019-07-30 09:41:08 -0400
commitfe2ae4e235a12198a530672d4db3fdcd167c6e65 (patch)
treef44fbc2b53eba3eadc51b851600b706c0e451d5a /src/client/util/SerializationHelper.ts
parent5591060e868053c8839fcc1de1ae77d4dac361ac (diff)
parente041988b84553797699a5a232e26e72252460e01 (diff)
Merge branch 'master' into youtube-api-muhammed
Diffstat (limited to 'src/client/util/SerializationHelper.ts')
-rw-r--r--src/client/util/SerializationHelper.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/util/SerializationHelper.ts b/src/client/util/SerializationHelper.ts
index 94b640afa..034be8f67 100644
--- a/src/client/util/SerializationHelper.ts
+++ b/src/client/util/SerializationHelper.ts
@@ -91,15 +91,15 @@ export function Deserializable(constructor: { new(...args: any[]): any } | strin
if (typeof constructor === "string") {
return Object.assign((ctor: { new(...args: any[]): any }) => {
addToMap(constructor, ctor);
- }, { withFields: Deserializable.withFields });
+ }, { withFields: (fields: string[]) => Deserializable.withFields(fields, name, afterDeserialize) });
}
addToMap(constructor.name, constructor);
}
export namespace Deserializable {
- export function withFields(fields: string[]) {
+ export function withFields(fields: string[], name?: string, afterDeserialize?: (obj: any) => void | Promise<any>) {
return function (constructor: { new(...fields: any[]): any }) {
- Deserializable(constructor);
+ Deserializable(name || constructor.name, afterDeserialize)(constructor);
let schema = getDefaultModelSchema(constructor);
if (schema) {
schema.factory = context => {