mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
TrustedNodesView.qml got rid of polling
This commit is contained in:
parent
620e5225f2
commit
2786cec76a
@ -24,14 +24,20 @@ import "jsonpath.js" as JSONPath
|
||||
Item
|
||||
{
|
||||
id: trustedNodesView
|
||||
property int token: 0
|
||||
|
||||
function refreshData()
|
||||
{
|
||||
rsApi.request("/peers/*", "",
|
||||
function(par) { jsonModel.json = par.response })
|
||||
}
|
||||
Component.onCompleted: refreshData()
|
||||
onFocusChanged: focus && refreshData()
|
||||
|
||||
function refreshDataCallback(par)
|
||||
{
|
||||
jsonModel.json = par.response
|
||||
token = JSON.parse(par.response).statetoken
|
||||
mainWindow.registerToken(token, refreshData)
|
||||
}
|
||||
function refreshData()
|
||||
{ if(visible) rsApi.request("/peers/*", "", refreshDataCallback) }
|
||||
|
||||
JSONListModel
|
||||
{
|
||||
id: jsonModel
|
||||
@ -136,13 +142,4 @@ Item
|
||||
onClicked: stackView.push("qrc:/qml/AddTrustedNode.qml")
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
Timer
|
||||
{
|
||||
interval: 800
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: if(trustedNodesView.visible) trustedNodesView.refreshData()
|
||||
Component.onCompleted: start()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user