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


TypeScript List.forEach方法代码示例

本文整理汇总了TypeScript中Immutable.List.forEach方法的典型用法代码示例。如果您正苦于以下问题:TypeScript List.forEach方法的具体用法?TypeScript List.forEach怎么用?TypeScript List.forEach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Immutable.List的用法示例。


在下文中一共展示了List.forEach方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: _onStorySelected

 @observeEvent(EventConst.STORY_SELECTED)
 _onStorySelected(event) {
     this._selectedStory = event.story;
     this._allStories.forEach(story => {
         story.isSelected = story === event.story;
     });
 }
开发者ID:esp,项目名称:esp-js,代码行数:7,代码来源:workspace.ts

示例2: getCustomerName

 public getCustomerName(appStore:AppStore) {
     let name:string = '';
     var businessId = this.getKey('businessId');
     var businessUsers:List<BusinessUser> = appStore.getState().business.get('businessUsers');
     businessUsers.forEach((businessUser:BusinessUser)=> {
         if (businessUser.getBusinessId() == businessId)
             name = businessUser.getName();
     })
     return name;
 }
开发者ID:amurarnd,项目名称:studioDashboard,代码行数:10,代码来源:StationModel.ts

示例3: getSource

 public getSource(appStore:AppStore) {
     let source:string = '';
     var businessId = this.getKey('businessId');
     var businesses:List<BusinessModel> = appStore.getState().business.get('businesses');
     businesses.forEach((business:BusinessModel)=> {
         if (business.getBusinessId() == businessId)
             source = business.getKey('source');
     })
     return source;
 }
开发者ID:amurarnd,项目名称:studioDashboard,代码行数:10,代码来源:StationModel.ts

示例4: findVerticalCollisionsWithCursor

export function findVerticalCollisionsWithCursor(timelineDuration: number, stacks: List<List<Record<Annotation>>>, currentTime: number) {
  const res: {annotation: Record<Annotation>, annotationIndex: number, annotationStackIndex: number}[] = []
  stacks.forEach((stack, annotationStackIndex) => {
    stack.forEach((annotation, annotationIndex) => {
      if(recordHasCollisionWithCursor(timelineDuration, annotation, currentTime)) {
        res.push({annotation, annotationIndex, annotationStackIndex})
      }
    })
  })
  return res
}
开发者ID:StudioProcess,项目名称:rvp,代码行数:11,代码来源:annotationStack.ts

示例5: _onEpicSelected

 @observeEvent(EventConst.EPIC_SELECTED)
 _onEpicSelected(event) {
     this._selectedEpic = event.epic;
     this._epics.forEach(epic => {
         epic.isSelected = epic === event.epic;
     });
     if (this._selectedStory && this._selectedStory.epic !== this._selectedEpic) {
         this._selectedStory.isSelected = false;
         this._selectedStory = null;
     }
 }
开发者ID:esp,项目名称:esp-js,代码行数:11,代码来源:workspace.ts

示例6: List

export function moveInList<T>(list: List<T>, itemIndex: number, insertPoint: number): List<T> {
  var n = list.size;
  if (itemIndex < 0 || itemIndex >= n) throw new Error('itemIndex out of range');
  if (insertPoint < 0 || insertPoint > n) throw new Error('insertPoint out of range');
  var newArray: T[] = [];
  list.forEach((value, i) => {
    if (i === insertPoint) newArray.push(list.get(itemIndex));
    if (i !== itemIndex) newArray.push(value);
  });
  if (n === insertPoint) newArray.push(list.get(itemIndex));
  return List(newArray);
}
开发者ID:fengweijp,项目名称:pivot,代码行数:12,代码来源:general.ts

示例7: postProcess

    // Gets called by the router when an event for this model has been processed by observers,
    // great place for aggregate operations and/or validation.
    postProcess() {
        this._allStories = this._epics.flatMap(epic => epic.stories).toList();

        if (this._selectedEpic) {
            this._displayedStories = this._allStories
                .filter(story => story.epic === this.selectedEpic)
                .toList();
        } else {
            this._displayedStories = this.allStories;
        }
        this._showAllStoriesButton = this.selectedEpic && this.allStories.count() !== this.displayedStories.count();
        this._epics.forEach(epic => {
            epic.postProcess();
        });
    }
开发者ID:esp,项目名称:esp-js,代码行数:17,代码来源:workspace.ts

示例8: findHorizontalCollisions

function findHorizontalCollisions(timelineDuration: number, list: List<Record<Annotation>>, indices: List<number>, checkSelf: boolean=false) {
  const collisions: {annotation: Record<Annotation>, index: number}[] = []
  const isInIndices = (k: number) => {
    if(checkSelf) {
      return indices.find(i => i === k) !== undefined
    } else {
      return false
    }
  }
  let n = 1
  let nextIndex
  indices.forEach(i => {
    // Collision to right
    n = 1
    nextIndex = i+n
    while(nextIndex < list.size && !isInIndices(nextIndex) && recordHasCollision(list.get(i)!, list.get(nextIndex)!, timelineDuration)) {
      collisions.push({annotation: list.get(nextIndex)!, index: nextIndex})
      nextIndex = i+(++n)
    }
    // Collision to left
    n = 1
    nextIndex = i-n
    while(nextIndex >= 0 && !isInIndices(nextIndex) && recordHasCollision(list.get(i)!, list.get(nextIndex)!, timelineDuration)) {
      collisions.push({annotation: list.get(nextIndex)!, index: nextIndex})
      nextIndex = i-(++n)
    }
  })

  const uniqueMapIndexMap: {[key: number]: boolean} = {}
  return collisions.filter(({index}) => {
    if(uniqueMapIndexMap[index]) {
      return false
    } else {
      uniqueMapIndexMap[index] = true
      return true
    }
  })
}
开发者ID:StudioProcess,项目名称:rvp,代码行数:38,代码来源:annotationStack.ts

示例9:

 return Map<string, number>().withMutations(mutable => {
   tasksForProject.forEach((task, index) => {
     mutable.set(task.display, index);
   });
 });
开发者ID:rsvoboda,项目名称:overbaard-redux,代码行数:5,代码来源:filter.util.ts


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