Reduce memory usage by dynamically creating Dates

This commit is contained in:
Amish Shah
2016-09-02 13:18:15 +01:00
parent b8a5669fda
commit ae17a89191
6 changed files with 49 additions and 32 deletions

View File

@@ -59,11 +59,7 @@ class GuildMember {
* @type {?String}
*/
this.voiceChannelID = data.channel_id;
/**
* The date this member joined the guild
* @type {Date}
*/
this.joinDate = new Date(data.joined_at);
this._joinDate = new Date(data.joined_at).getTime();
/**
* Whether this meember is speaking
* @type {?Boolean}
@@ -77,6 +73,14 @@ class GuildMember {
this._roles = data.roles;
}
/**
* The date this member joined the guild
* @type {Date}
*/
get joinDate() {
return new Date(this._joinDate);
}
/**
* A list of roles that are applied to this GuildMember
* @type {Array<Role>}