Move home library loading into function

This commit is contained in:
Neil Burrows 2020-12-08 15:56:13 +00:00
parent ffcf5e48a7
commit f3019f3e7f
5 changed files with 11 additions and 1 deletions

View File

@ -5,4 +5,8 @@ end sub
function refresh()
m.top.findNode("homeRows").callFunc("updateHomeRows")
end function
function loadLibraries()
m.top.findNode("homeRows").callFunc("loadLibraries")
end function

View File

@ -9,6 +9,7 @@
<field id="userConfig" alias="homeRows.userConfig" />
<field id="timeLastRefresh" type="integer" />
<function name="refresh" />
<function name="loadLibraries" />
</interface>
<script type="text/brightscript" uri="Home.brs" />
</component>

View File

@ -21,7 +21,6 @@ sub init()
' Load the Libraries from API via task
m.LoadLibrariesTask = createObject("roSGNode", "LoadItemsTask")
m.LoadLibrariesTask.observeField("content", "onLibrariesLoaded")
m.LoadLibrariesTask.control = "RUN"
' set up tesk nodes for other rows
m.LoadContinueTask = createObject("roSGNode", "LoadItemsTask")
m.LoadContinueTask.itemsToLoad = "continue"
@ -29,6 +28,10 @@ sub init()
m.LoadNextUpTask.itemsToLoad = "nextUp"
end sub
function loadLibraries()
m.LoadLibrariesTask.control = "RUN"
end function
sub updateSize()
sideborder = 100
m.top.translation = [111, 180]

View File

@ -4,6 +4,7 @@
<field id="selectedItem" type="node" alwaysNotify="true" />
<field id="userConfig" type="assocarray" />
<function name="updateHomeRows" />
<function name="loadLibraries" />
</interface>
<script type="text/brightscript" uri="HomeRows.brs"/>
</component>

View File

@ -36,6 +36,7 @@ sub Main()
m.overhang.showOptions = true
group = CreateHomeGroup()
group.userConfig = m.user.configuration
group.callFunc("loadLibraries")
m.scene.appendChild(group)
m.scene.observeField("backPressed", m.port)