From ee4a8bb3b6819f8638e7715049d4953784aa3e45 Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Sun, 20 Nov 2016 22:45:59 -0500 Subject: [PATCH] Made Client.browser a getter --- src/client/Client.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index bf784a7ab..e39b2c4bd 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -23,12 +23,6 @@ class Client extends EventEmitter { constructor(options = {}) { super(); - /** - * Whether the client is in a browser environment - * @type {boolean} - */ - this.browser = typeof window !== 'undefined'; - // Obtain shard details from environment if (!options.shardId && 'SHARD_ID' in process.env) options.shardId = Number(process.env.SHARD_ID); if (!options.shardCount && 'SHARD_COUNT' in process.env) options.shardCount = Number(process.env.SHARD_COUNT); @@ -212,6 +206,15 @@ class Client extends EventEmitter { return this.readyAt ? this.readyAt.getTime() : null; } + /** + * Whether the client is in a browser environment + * @type {boolean} + * @readonly + */ + get browser() { + return typeof window !== 'undefined'; + } + /** * Logs the client in. If successful, resolves with the account's token. If you're making a bot, it's * much better to use a bot account rather than a user account.