diff options
Diffstat (limited to 'client/src/assets/player/peertube-chunk-store.ts')
-rw-r--r-- | client/src/assets/player/peertube-chunk-store.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/client/src/assets/player/peertube-chunk-store.ts b/client/src/assets/player/peertube-chunk-store.ts index 767e46821..ac3f9e654 100644 --- a/client/src/assets/player/peertube-chunk-store.ts +++ b/client/src/assets/player/peertube-chunk-store.ts | |||
@@ -40,15 +40,15 @@ export class PeertubeChunkStore extends EventEmitter { | |||
40 | // If the store is full | 40 | // If the store is full |
41 | private memoryChunks: { [ id: number ]: Buffer | true } = {} | 41 | private memoryChunks: { [ id: number ]: Buffer | true } = {} |
42 | private databaseName: string | 42 | private databaseName: string |
43 | private putBulkTimeout | 43 | private putBulkTimeout: any |
44 | private cleanerInterval | 44 | private cleanerInterval: any |
45 | private db: ChunkDatabase | 45 | private db: ChunkDatabase |
46 | private expirationDB: ExpirationDatabase | 46 | private expirationDB: ExpirationDatabase |
47 | private readonly length: number | 47 | private readonly length: number |
48 | private readonly lastChunkLength: number | 48 | private readonly lastChunkLength: number |
49 | private readonly lastChunkIndex: number | 49 | private readonly lastChunkIndex: number |
50 | 50 | ||
51 | constructor (chunkLength: number, opts) { | 51 | constructor (chunkLength: number, opts: any) { |
52 | super() | 52 | super() |
53 | 53 | ||
54 | this.databaseName = 'webtorrent-chunks-' | 54 | this.databaseName = 'webtorrent-chunks-' |
@@ -113,13 +113,13 @@ export class PeertubeChunkStore extends EventEmitter { | |||
113 | }, PeertubeChunkStore.BUFFERING_PUT_MS) | 113 | }, PeertubeChunkStore.BUFFERING_PUT_MS) |
114 | } | 114 | } |
115 | 115 | ||
116 | get (index: number, opts, cb) { | 116 | get (index: number, opts: any, cb: any): any { |
117 | if (typeof opts === 'function') return this.get(index, null, opts) | 117 | if (typeof opts === 'function') return this.get(index, null, opts) |
118 | 118 | ||
119 | // IndexDB could be slow, use our memory index first | 119 | // IndexDB could be slow, use our memory index first |
120 | const memoryChunk = this.memoryChunks[index] | 120 | const memoryChunk = this.memoryChunks[index] |
121 | if (memoryChunk === undefined) { | 121 | if (memoryChunk === undefined) { |
122 | const err = new Error('Chunk not found') | 122 | const err = new Error('Chunk not found') as any |
123 | err['notFound'] = true | 123 | err['notFound'] = true |
124 | 124 | ||
125 | return process.nextTick(() => cb(err)) | 125 | return process.nextTick(() => cb(err)) |
@@ -146,11 +146,11 @@ export class PeertubeChunkStore extends EventEmitter { | |||
146 | }) | 146 | }) |
147 | } | 147 | } |
148 | 148 | ||
149 | close (db) { | 149 | close (db: any) { |
150 | return this.destroy(db) | 150 | return this.destroy(db) |
151 | } | 151 | } |
152 | 152 | ||
153 | async destroy (cb) { | 153 | async destroy (cb: any) { |
154 | try { | 154 | try { |
155 | if (this.pendingPut) { | 155 | if (this.pendingPut) { |
156 | clearTimeout(this.putBulkTimeout) | 156 | clearTimeout(this.putBulkTimeout) |
@@ -225,7 +225,7 @@ export class PeertubeChunkStore extends EventEmitter { | |||
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | private nextTick (cb, err, val?) { | 228 | private nextTick (cb: any, err: Error, val?: any) { |
229 | process.nextTick(() => cb(err, val), undefined) | 229 | process.nextTick(() => cb(err, val), undefined) |
230 | } | 230 | } |
231 | } | 231 | } |