"use strict"; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var request = require("superagent"); var defaultOptions = { cache_tokens: false }; var Client = (function () { function Client() { var options = arguments.length <= 0 || arguments[0] === undefined ? defaultOptions : arguments[0]; var token = arguments.length <= 1 || arguments[1] === undefined ? undefined : arguments[1]; _classCallCheck(this, Client); /* When created, if a token is specified the Client will try connecting with it. If the token is incorrect, no further efforts will be made to connect. */ this.options = options; this.token = token; this.state = 0; this.websocket = null; this.events = new Map(); this.user = null; /* State values: 0 - idle 1 - logging in 2 - logged in 3 - ready 4 - disconnected */ } _createClass(Client, [{ key: "login", //def login value: function login() { var email = arguments.length <= 0 || arguments[0] === undefined ? "foo@bar.com" : arguments[0]; var password = arguments.length <= 1 || arguments[1] === undefined ? "pass1234s" : arguments[1]; if (this.state === 0 || this.state === 4) { this.state = 1; request.post(); } } }, { key: "ready", get: function get() { return this.state === 3; } }]); return Client; })();