Created
January 24, 2020 16:29
-
-
Save fireflysemantics/691abe8645d212d647f4174271e1a8a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Class mapped to the the contacts table in db.ts by the line: | |
* db.contacts.mapToClass(Contact) | |
*/ | |
export class Contact extends AbstractEntity { | |
emails: EmailAddress[] | |
phones: PhoneNumber[] | |
constructor( | |
public firstName: string, | |
public lastName: string, | |
gid?: string | |
) { | |
super(gid) | |
// Define navigation properties. | |
// Making them non-enumerable will prevent them from being handled by indexedDB | |
// when doing put() or add(). | |
Object.defineProperties(this, { | |
emails: { value: [], enumerable: false, writable: true }, | |
phones: { value: [], enumerable: false, writable: true } | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment