當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript mithril.startComputation函數代碼示例

本文整理匯總了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
 }
開發者ID:Draggha,項目名稱:pickdrasil-mithril,代碼行數:8,代碼來源:nodedata.ts

示例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])
}
開發者ID:Draggha,項目名稱:pickdrasil-mithril,代碼行數:15,代碼來源:searchbar.ts

示例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
 }
開發者ID:Draggha,項目名稱:pickdrasil-mithril,代碼行數:20,代碼來源:nodedata.ts

示例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()
   }
 })
開發者ID:Draggha,項目名稱:pickdrasil-mithril,代碼行數:24,代碼來源:nodedata.ts

示例5:

 fs.readFile(storedFileName, "utf-8", (err: any, data: any) => {
     m.startComputation();
     context.loadData(data);
     m.endComputation();
 });
開發者ID:AlexanderLindsay,項目名稱:dailybudgeteer,代碼行數:5,代碼來源:start.ts


注:本文中的mithril.startComputation函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。