small refactor
This commit is contained in:
1 parent
8c72258879
commit
707739b901
1 file changed
+7
-12
@@ -35,7 +35,6 @@ function OnNodeReady()
|
|||||||
|
|
||||||
m.container.observeFieldScoped("fullscreen", FuncName(OnFullScreenChange))
|
m.container.observeFieldScoped("fullscreen", FuncName(OnFullScreenChange))
|
||||||
m.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
m.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
||||||
m.top.observeField("control", FuncName(OnControlChange))
|
|
||||||
|
|
||||||
SponsorBlock.SetupSponsorBlock()
|
SponsorBlock.SetupSponsorBlock()
|
||||||
end function
|
end function
|
||||||
@@ -117,17 +116,6 @@ function MarkVideoWatched(videoId as string)
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function Close(_unused as dynamic)
|
function Close(_unused as dynamic)
|
||||||
m.top.control = "stop"
|
|
||||||
m.top.content = invalid
|
|
||||||
parent = m.top.getParent()
|
|
||||||
if parent <> invalid
|
|
||||||
parent.RemoveChild(m.top)
|
|
||||||
end if
|
|
||||||
SponsorBlock.RemoveNotifcation(m.notifications)
|
|
||||||
end function
|
|
||||||
|
|
||||||
function OnControlChange()
|
|
||||||
if m.top.control = "stop"
|
|
||||||
if m.videoContentTask <> invalid
|
if m.videoContentTask <> invalid
|
||||||
m.videoContentTask.cancel = true
|
m.videoContentTask.cancel = true
|
||||||
m.videoContentTask = invalid
|
m.videoContentTask = invalid
|
||||||
@@ -136,7 +124,14 @@ function OnControlChange()
|
|||||||
m.sponsorBlockTask.cancel = true
|
m.sponsorBlockTask.cancel = true
|
||||||
m.sponsorBlockTask = invalid
|
m.sponsorBlockTask = invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
m.top.control = "stop"
|
||||||
|
m.top.content = invalid
|
||||||
|
parent = m.top.getParent()
|
||||||
|
if parent <> invalid
|
||||||
|
parent.RemoveChild(m.top)
|
||||||
end if
|
end if
|
||||||
|
SponsorBlock.RemoveNotifcation(m.notifications)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
' TODO:P2 investigate timeouts caused by control="stop" being synchrounous and too slow
|
' TODO:P2 investigate timeouts caused by control="stop" being synchrounous and too slow
|
||||||
|
|||||||
Reference in new issue
Block a user