diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2019-07-25 13:01:30 -0400 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-07-25 13:01:30 -0400 |
commit | 93515e3f152ad91c009a07bc316af9bb7676dd7d (patch) | |
tree | 66e94f18226ae2adeda07ff3347c59429de6400e /src/client/util/SerializationHelper.ts | |
parent | 6c111fdc538775f9f7b04f91d0b5701fd2a1aaca (diff) | |
parent | 18a0850353b0fc55cbf7ae1d4e2763919fc78bca (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/util/SerializationHelper.ts')
-rw-r--r-- | src/client/util/SerializationHelper.ts | 6 |
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 => { |