本文整理匯總了TypeScript中mithril.startComputation函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript startComputation函數的具體用法?TypeScript startComputation怎麽用?TypeScript startComputation使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了startComputation函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: return
return (errorCode) => {
if (errorCode) {
m.startComputation()
_errorCode = errorCode
m.endComputation()
}
return _errorCode || ErrorCodes.NONE
}
示例2: radio
let search = (treeViewInstance, value) => {
m.startComputation()
let searchTerm = value.toLowerCase()
if (willChange) {
radio(PubSubTopics.TREE_STRUCTURE_CHANGED).unsubscribe(updateAllNodes)
clearTimeout(willChange)
m.endComputation()
}
let context = { treeViewInstance: treeViewInstance, searchTerm: searchTerm }
willChange = setTimeout(updateAllNodes.bind(context), 300)
// retrigger the search every time the tree structure changes (this happens when nodes are created/deleted)
radio(PubSubTopics.TREE_STRUCTURE_CHANGED).subscribe([updateAllNodes, context])
}
示例3: selectedAccessor
return function selectedAccessor(selected) {
if (selected !== void 0) {
cachedSelected = selected
m.startComputation()
if (selected) {
// deselect all previously selected nodes
root.selectedNodes().map((node) => {
node.selected(false)
})
// override all previously cached selected nodes with the currently selected one
root.selectedNodes([this])
} else {
root.selectedNodes(root.selectedNodes().filter((node) => {
return node.id() !== this.id()
}))
}
m.endComputation()
}
return cachedSelected
}
示例4: Promise
return new Promise((resolve, reject) => {
if (!childData) {
reject('[createChild] Tree node creation failed: No data given! Please check your options.childData object.')
} else if (!childData.id) {
reject('[createChild] Tree node creation failed: No id given! Please ensure options.childData.id is filled with a "valid" id string.' +
' "Valid" id strings are based on HTML element ids.')
} else if (!childData.title) {
reject('[createChild] Tree node creation failed: No title given! Please ensure options.childData.title is filled with a string.')
} else {
childData.root = root
childData.parent = nodeData
childData.events = nodeData.events
if (nodeData.errorCode() === ErrorCodes.NOT_FOUND) {
nodeData.errorCode(ErrorCodes.NONE)
}
let newTreeNode = createNodeData(childData)
let newChildList = nodeData.children()
newChildList.push(newTreeNode)
nodeData.children(newChildList)
m.startComputation()
resolve(newTreeNode)
m.endComputation()
}
})
示例5:
fs.readFile(storedFileName, "utf-8", (err: any, data: any) => {
m.startComputation();
context.loadData(data);
m.endComputation();
});