twilio-chat
Advanced tools
Comparing version 0.13.0-dev-build.330 to 0.13.0-dev-build.331
@@ -120,3 +120,3 @@ "use strict"; | ||
list.on('itemRemoved', function (index) { | ||
var message = _this2._removeMessageById(index); | ||
var message = _this2.removeMessageById(index); | ||
if (message) { | ||
@@ -179,4 +179,4 @@ _this2.messagesByIndex.delete(message.index); | ||
}, { | ||
key: "_removeMessageById", | ||
value: function _removeMessageById(messageId) { | ||
key: "removeMessageById", | ||
value: function removeMessageById(messageId) { | ||
var removedMessage = void 0; | ||
@@ -246,4 +246,4 @@ for (var i = 0; i < this.sortedMessages.length; i++) { | ||
}, { | ||
key: "_wrapPaginator", | ||
value: function _wrapPaginator(order, page, op) { | ||
key: "wrapPaginator", | ||
value: function wrapPaginator(order, page, op) { | ||
var _this3 = this; | ||
@@ -255,3 +255,3 @@ | ||
return page.nextPage().then(function (x) { | ||
return _this3._wrapPaginator(order, x, op); | ||
return _this3.wrapPaginator(order, x, op); | ||
}); | ||
@@ -261,3 +261,3 @@ }; | ||
return page.prevPage().then(function (x) { | ||
return _this3._wrapPaginator(order, x, op); | ||
return _this3.wrapPaginator(order, x, op); | ||
}); | ||
@@ -312,3 +312,3 @@ }; | ||
}).then(function (page) { | ||
return _this5._wrapPaginator(order, page, function (items) { | ||
return _this5.wrapPaginator(order, page, function (items) { | ||
return _promise2.default.all(items.map(function (item) { | ||
@@ -315,0 +315,0 @@ return _this5._upsertMessage(item.index, item.value); |
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
import { Message } from '../message'; | ||
import { Channel } from '../channel'; | ||
@@ -28,3 +27,3 @@ /** | ||
*/ | ||
_removeMessageById(messageId: number): Message; | ||
private removeMessageById(messageId); | ||
/** | ||
@@ -44,4 +43,4 @@ * Send Message to the channel | ||
getMessages(pageSize: any, anchor: any, direction: any): Promise<any>; | ||
_wrapPaginator(order: any, page: any, op: any): any; | ||
_upsertMessage(index: number, value: string): Message; | ||
private wrapPaginator(order, page, op); | ||
private _upsertMessage(index, value); | ||
/** | ||
@@ -54,4 +53,4 @@ * Returns last messages from channel | ||
*/ | ||
_getMessages(pageSize: any, anchor: any, direction: any): Promise<any>; | ||
private _getMessages(pageSize, anchor, direction); | ||
} | ||
export { Messages }; |
@@ -51,3 +51,3 @@ "use strict"; | ||
list.on('itemRemoved', index => { | ||
let message = this._removeMessageById(index); | ||
let message = this.removeMessageById(index); | ||
if (message) { | ||
@@ -87,3 +87,3 @@ this.messagesByIndex.delete(message.index); | ||
*/ | ||
_removeMessageById(messageId) { | ||
removeMessageById(messageId) { | ||
let removedMessage; | ||
@@ -128,7 +128,7 @@ for (let i = 0; i < this.sortedMessages.length; i++) { | ||
} | ||
_wrapPaginator(order, page, op) { | ||
wrapPaginator(order, page, op) { | ||
// We should swap next and prev page here, because of misfit of Sync and Chat paging conceptions | ||
let shouldReverse = order === 'desc'; | ||
let np = () => page.nextPage().then(x => this._wrapPaginator(order, x, op)); | ||
let pp = () => page.prevPage().then(x => this._wrapPaginator(order, x, op)); | ||
let np = () => page.nextPage().then(x => this.wrapPaginator(order, x, op)); | ||
let pp = () => page.prevPage().then(x => this.wrapPaginator(order, x, op)); | ||
return op(page.items).then(items => ({ | ||
@@ -165,5 +165,5 @@ items: items.sort((x, y) => { return x.index - y.index; }), | ||
.then(messagesList => messagesList.getItems({ from: anchor !== 'end' ? anchor : void (0), pageSize, order })) | ||
.then(page => this._wrapPaginator(order, page, items => Promise.all(items.map(item => this._upsertMessage(item.index, item.value))))); | ||
.then(page => this.wrapPaginator(order, page, items => Promise.all(items.map(item => this._upsertMessage(item.index, item.value))))); | ||
} | ||
} | ||
exports.Messages = Messages; |
{ | ||
"name": "twilio-chat", | ||
"version": "0.13.0-dev-build.330", | ||
"version": "0.13.0-dev-build.331", | ||
"description": "Twilio Chat service client library", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1941140
39148