I'm starting on KDE Plasma 5 plasmoids developments and I'm trying to make a plasmoid that fetches data from an API every 10 seconds and shows it in a Label (from org.kde.plasma.components
).
In browser environments we can use setTimeout
with no problems, but what to do in environments like that when these functions aren't available?
I tried to make a while(true)
loop on Component.onCompleted
hook, but as expected, the Plasmoid didn't loaded and my CPU went crazy.
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Row {
id: 'container'
Component.onCompleted: {
let counter = 0;
while(true) {
textContainer.text = counter;
counter++;
}
}
PlasmaComponents.Label {
id: 'textContainer'
text: ''
width: 384
}
}