rewriting... woo

This commit is contained in:
hydrabolt
2015-08-24 17:07:41 +01:00
parent 344f8d73a4
commit 1f77ed226a
10 changed files with 614 additions and 131 deletions

View File

@@ -1,31 +1,33 @@
"use strict";
var List = require("./list.js").List;
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; }; })();
exports.Channel = function (name, server, type, id, isPrivate) {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
if (!type) {
//there's no second argument
var channel = name;
name = channel.name;
server = server;
type = channel.type;
id = channel.id;
isPrivate = channel.is_private;
var Channel = (function () {
function Channel(data, server) {
_classCallCheck(this, Channel);
this.server = server;
this.name = data.name;
this.type = data.type;
this.id = data.id;
//this.isPrivate = isPrivate; //not sure about the implementation of this...
}
this.name = name;
this.server = server;
this.type = type;
this.id = id;
this.isPrivate = isPrivate;
this.messages = new List("id", 5000);
};
_createClass(Channel, [{
key: "equals",
value: function equals(object) {
return object.id === this.id;
}
}, {
key: "client",
get: function get() {
return this.server.client;
}
}]);
exports.Channel.equals = function (otherChannel) {
if (otherChannel.id === this.id) {
return true;
} else {
return false;
}
};
return Channel;
})();
module.exports = Channel;