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

@@ -260,11 +260,7 @@ class Guild {
* @type {Boolean}
*/
this.large = data.large;
/**
* The date at which the logged-in client joined the guild.
* @type {Date}
*/
this.joinDate = new Date(data.joined_at);
this._joinDate = new Date(data.joined_at).getTime();
/**
* The hash of the guild icon, or null if there is no icon.
* @type {?String}
@@ -359,6 +355,13 @@ class Guild {
}
}
}
/**
* The date at which the logged-in client joined the guild.
* @type {Date}
*/
get joinDate() {
return new Date(this._joinDate);
}
/**
* Creates a new Channel in the Guild.