mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-24 13:32:22 +00:00
cb7e67ce8c
Closes: #7818
22 lines
574 B
QML
22 lines
574 B
QML
pragma Singleton
|
|
import QtQml 2.14
|
|
|
|
QtObject {
|
|
function singleShotConnection(prop, handler) {
|
|
const internalHandler = (...args) => {
|
|
handler(...args)
|
|
prop.disconnect(internalHandler)
|
|
}
|
|
prop.connect(internalHandler)
|
|
}
|
|
|
|
function getUniqueValuesFromModel(model, prop) {
|
|
const values = []
|
|
for (let i = 0; i < model.count; i++)
|
|
values.push(model.get(i)[prop])
|
|
|
|
const onlyUnique = (value, index, self) => self.indexOf(value) === index
|
|
return values.filter(onlyUnique)
|
|
}
|
|
}
|