33 lines
721 B
JavaScript
33 lines
721 B
JavaScript
function newNodesProgress () {
|
|
const MODULE_NAME = 'Nodes Progress'
|
|
const logger = newWebDebugLog()
|
|
logger.fileName = MODULE_NAME
|
|
|
|
let thisObject = {
|
|
onRecordChange: onRecordChange,
|
|
initialize: initialize,
|
|
finalize: finalize
|
|
}
|
|
|
|
let rootNode
|
|
return thisObject
|
|
|
|
function finalize () {
|
|
rootNode = undefined
|
|
}
|
|
|
|
function initialize (pRootNode) {
|
|
rootNode = pRootNode
|
|
}
|
|
|
|
function onRecordChange (currentRecord) {
|
|
evalNode(rootNode, currentRecord.array, 0, applyProgress)
|
|
}
|
|
|
|
function applyProgress (node, value) {
|
|
if (node.payload === undefined) { return }
|
|
if (node.payload.uiObject === undefined) { return }
|
|
node.payload.uiObject.setPercentage(node, value)
|
|
}
|
|
}
|