| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- var
- /**
- * @type SlackWrapper
- **/
- SLACK
- ;
- /**
- * @constructor
- **/
- function SlackWrapper() {
- /** @type {number} */
- this.lastServerVersion = 0;
- /** @type {SlackData} */
- this.context = new SlackData(null);
- /** @type {!Object.<string, SlackHistory>} **/
- this.history = {};
- }
- SlackWrapper.prototype.update = function(data) {
- if (data["v"])
- this.lastServerVersion = data["v"];
- if (data["static"]) {
- this.context.updateStatic(data["static"]);
- onContextUpdated();
- }
- if (data["live"]) {
- for (var i in data["live"]) {
- var history = this.history[i];
- if (!history)
- this.history[i] = new SlackHistory(i, data["live"][i]);
- else
- history.pushAll(data["live"][i]);
- }
- if (SELECTED_ROOM && data["live"][SELECTED_ROOM.id]) {
- onRoomUpdated();
- }
- }
- console.log(this);
- };
- SLACK = new SlackWrapper();
|