aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/ChunkManager.ts
blob: 64c073640c65fb8c767289d3075792467d0e570b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { SimplifiedChunk } from './types';

class ChunkManager {
    private chunks: SimplifiedChunk[];

    constructor() {
        this.chunks = [];
    }

    addChunk(chunk: SimplifiedChunk) {
        this.chunks.push(chunk);
    }

    removeChunk(chunk: SimplifiedChunk) {
        const index = this.chunks.indexOf(chunk);
        if (index !== -1) {
            this.chunks.splice(index, 1);
        }
    }

    getChunks() {
        return this.chunks;
    }
}