本文整理汇总了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;
});
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
}
示例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);
}
示例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();
});
}
示例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
}
})
}
示例9:
return Map<string, number>().withMutations(mutable => {
tasksForProject.forEach((task, index) => {
mutable.set(task.display, index);
});
});