mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-19 04:52:05 +00:00
fix: sub parser event leak
This commit is contained in:
parent
002bf97331
commit
920e672d17
2 changed files with 4 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "3.3.6",
|
||||
"version": "3.3.7",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||
"main": "src/index.js",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class TorrentClient extends WebTorrent {
|
|||
this.current = null
|
||||
this.parsed = false
|
||||
this.parserInstance = null
|
||||
this.boundParse = this.parseSubtitles.bind(this)
|
||||
|
||||
setInterval(() => {
|
||||
this.dispatch('stats', {
|
||||
|
|
@ -102,7 +103,7 @@ class TorrentClient extends WebTorrent {
|
|||
handleMessage ({ data }) {
|
||||
switch (data.type) {
|
||||
case 'current': {
|
||||
this.current?.removeListener('done', this.parseSubtitles.bind(this))
|
||||
this.current?.removeListener('done', this.boundParse)
|
||||
this.cancelParse()
|
||||
this.parserInstance?.destroy()
|
||||
this.parserInstance = null
|
||||
|
|
@ -112,7 +113,7 @@ class TorrentClient extends WebTorrent {
|
|||
this.current = this?.get(data.data.infoHash)?.files.find(file => file.path === data.data.path)
|
||||
if (this.current?.name.endsWith('.mkv')) {
|
||||
if (this.current.done) this.parseSubtitles()
|
||||
this.current.on('done', this.parseSubtitles.bind(this))
|
||||
this.current.once('done', this.boundParse)
|
||||
this.parseFonts(this.current)
|
||||
}
|
||||
// TODO: findSubtitleFiles(current)
|
||||
|
|
|
|||
Loading…
Reference in a new issue