UNPKG

podchat-browser

Version:

Javascript SDK to use POD's Chat Service - Browser Only

30 lines (25 loc) 782 B
export default class Archive { constructor(thread) { this.thread = thread; this._list = thread._list; } archiveThread(threadId) { const thread = this.thread.getThreadItemById(threadId); if (thread) { this._list.archive.push(thread); this.thread.remove(threadId) } return thread; } unArchiveThread(threadId) { const thread = this.thread.getThreadItemById(threadId,'archive'); if (thread) { this._list.main.unshift(thread); const index = this.thread.findIndex(threadId,'archive'); if (index > -1) { this._list.archive.splice(index, 1); } } return thread; } }