diff --git a/lib/Client/Client.js b/lib/Client/Client.js index c5919ff70..c7981517c 100644 --- a/lib/Client/Client.js +++ b/lib/Client/Client.js @@ -57,7 +57,7 @@ var Client = (function (_EventEmitter) { _EventEmitter.call(this); this.options = options || {}; - this.options.compress = options.compress || true; + this.options.compress = options.compress || !process.browser; this.options.revive = options.revive || false; this.options.rate_limit_as_error = options.rate_limit_as_error || false; this.internal = new _InternalClient2["default"](this); diff --git a/lib/Util/TokenCacher-shim.js b/lib/Util/TokenCacher-shim.js new file mode 100644 index 000000000..f483e9575 --- /dev/null +++ b/lib/Util/TokenCacher-shim.js @@ -0,0 +1,29 @@ +// Shim for the token cacher in the browser. +"use strict"; + +exports.__esModule = true; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var TokenCacher = (function () { + function TokenCacher() { + _classCallCheck(this, TokenCacher); + } + + TokenCacher.prototype.setToken = function setToken() {}; + + TokenCacher.prototype.save = function save() {}; + + TokenCacher.prototype.getToken = function getToken() { + return null; + }; + + TokenCacher.prototype.init = function init(ind) { + this.done = true; + }; + + return TokenCacher; +})(); + +exports["default"] = TokenCacher; +module.exports = exports["default"]; diff --git a/package.json b/package.json index 3d656adbe..93edbaaed 100644 --- a/package.json +++ b/package.json @@ -44,5 +44,9 @@ }, "engines": { "node": ">=0.12.7" + }, + "browser": { + "./src/Util/TokenCacher.js": "./src/Util/TokenCacher-shim.js", + "./lib/Util/TokenCacher.js": "./lib/Util/TokenCacher-shim.js" } } diff --git a/src/Client/Client.js b/src/Client/Client.js index 321c552d6..b9f4ff5eb 100644 --- a/src/Client/Client.js +++ b/src/Client/Client.js @@ -32,7 +32,7 @@ export default class Client extends EventEmitter { constructor(options = {}) { super(); this.options = options || {}; - this.options.compress = options.compress || true; + this.options.compress = options.compress || (!process.browser); this.options.revive = options.revive || false; this.options.rate_limit_as_error = options.rate_limit_as_error || false; this.internal = new InternalClient(this); diff --git a/src/Util/TokenCacher-shim.js b/src/Util/TokenCacher-shim.js new file mode 100644 index 000000000..e9fb42058 --- /dev/null +++ b/src/Util/TokenCacher-shim.js @@ -0,0 +1,19 @@ +// Shim for the token cacher in the browser. +export default class TokenCacher { + constructor() { + } + + setToken() { + } + + save() { + } + + getToken() { + return null; + } + + init(ind) { + this.done = true; + } +}