当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript mithril.endComputation函数代码示例

本文整理汇总了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
 }
开发者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: 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()
}
开发者ID:Draggha,项目名称:pickdrasil-mithril,代码行数:22,代码来源:searchbar.ts

示例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()
   }
 })
开发者ID:Draggha,项目名称:pickdrasil-mithril,代码行数:24,代码来源:nodedata.ts

示例6:

 fs.readFile(storedFileName, "utf-8", (err: any, data: any) => {
     m.startComputation();
     context.loadData(data);
     m.endComputation();
 });
开发者ID:AlexanderLindsay,项目名称:dailybudgeteer,代码行数:5,代码来源:start.ts


注:本文中的mithril.endComputation函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。