本文整理汇总了TypeScript中mithril.endComputation函数的典型用法代码示例。如果您正苦于以下问题:TypeScript endComputation函数的具体用法?TypeScript endComputation怎么用?TypeScript endComputation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了endComputation函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: function
let updateAllNodes = function () {
let treeViewInstance = this.treeViewInstance
let searchTerm = this.searchTerm
let markSearchResult = (childNode) => {
if (searchTerm && searchTerm !== '') {
let searchTermFound = (childNode.title().toLowerCase().indexOf(searchTerm) > -1)
childNode.highlighted(searchTermFound)
childNode.blurred(!searchTermFound)
} else {
childNode.highlighted(false)
childNode.blurred(false)
}
}
treeViewInstance.getRootNodes().map((rootNode) => {
if (rootNode.isLeaf()) {
markSearchResult(rootNode)
} else {
rootNode.traverseChildNodes(markSearchResult)
}
})
m.endComputation()
}
示例5: 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()
}
})
示例6:
fs.readFile(storedFileName, "utf-8", (err: any, data: any) => {
m.startComputation();
context.loadData(data);
m.endComputation();
});