Created
January 21, 2020 23:07
-
-
Save fireflysemantics/14594af479add117cb4971e902474939 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 { | |
id: string; | |
firstName: string; | |
lastName: string; | |
emails: IEmailAddress[]; | |
phones: IPhoneNumber[]; | |
constructor(first: string, last: string, id?:string) { | |
this.firstName = first; | |
this.lastName = last; | |
if (id) this.id = id; | |
// 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