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.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
||||
m.top.observeField("control", FuncName(OnControlChange))
|
||||
|
||||
SponsorBlock.SetupSponsorBlock()
|
||||
end function
|
||||
@@ -117,17 +116,6 @@ function MarkVideoWatched(videoId as string)
|
||||
end function
|
||||
|
||||
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
|
||||
m.videoContentTask.cancel = true
|
||||
m.videoContentTask = invalid
|
||||
@@ -136,7 +124,14 @@ function OnControlChange()
|
||||
m.sponsorBlockTask.cancel = true
|
||||
m.sponsorBlockTask = invalid
|
||||
end if
|
||||
|
||||
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
|
||||
|
||||
' TODO:P2 investigate timeouts caused by control="stop" being synchrounous and too slow
|
||||
|
||||
Reference in new issue
Block a user