aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-chunk-store.ts
diff options
context:
space:
mode:
authorBO41 <lukasw41@gmail.com>2018-10-18 09:08:59 +0200
committerRigel Kent <par@rigelk.eu>2018-10-18 09:08:59 +0200
commit244b4ae3973bc1511464a08158a123767f83179c (patch)
tree24f4399489167bc92921e3fe0c1c04a87d7c1161 /client/src/assets/player/peertube-chunk-store.ts
parent28e51e831bd121f063600a597d7b02f8fd846de9 (diff)
downloadPeerTube-244b4ae3973bc1511464a08158a123767f83179c.tar.gz
PeerTube-244b4ae3973bc1511464a08158a123767f83179c.tar.zst
PeerTube-244b4ae3973bc1511464a08158a123767f83179c.zip
NoImplicitAny flag true (#1157)
this enables the `noImplicitAny` flag in the Typescript compiler > When the noImplicitAny flag is true and the TypeScript compiler cannot infer the type, it still generates the JavaScript files, but it also reports an error. Many seasoned developers prefer this stricter setting because type checking catches more unintentional errors at compile time. closes: #1131 replaces #1137
Diffstat (limited to 'client/src/assets/player/peertube-chunk-store.ts')
-rw-r--r--client/src/assets/player/peertube-chunk-store.ts16
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}