| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 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, 500, data["live"][i]);
- else
- history.pushAll(data["live"][i]);
- }
- if (SELECTED_ROOM && data["live"][SELECTED_ROOM.id]) {
- onRoomUpdated();
- }
- }
- };
- SLACK = new SlackWrapper();
|