本文整理汇总了TypeScript中angular2/src/core/facade/collection.Map类的典型用法代码示例。如果您正苦于以下问题:TypeScript Map类的具体用法?TypeScript Map怎么用?TypeScript Map使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Map类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: coalesce
export function coalesce(records: ProtoRecord[]): ProtoRecord[] {
var res: ProtoRecord[] = [];
var indexMap: Map<number, number> = new Map<number, number>();
for (var i = 0; i < records.length; ++i) {
var r = records[i];
var record = _replaceIndices(r, res.length + 1, indexMap);
var matchingRecord = _findMatching(record, res);
if (isPresent(matchingRecord) && record.lastInBinding) {
res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1));
indexMap.set(r.selfIndex, matchingRecord.selfIndex);
matchingRecord.referencedBySelf = true;
} else if (isPresent(matchingRecord) && !record.lastInBinding) {
if (record.argumentToPureFunction) {
matchingRecord.argumentToPureFunction = true;
}
indexMap.set(r.selfIndex, matchingRecord.selfIndex);
} else {
res.push(record);
indexMap.set(r.selfIndex, record.selfIndex);
}
}
return res;
}
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:29,代码来源:coalesce.ts
示例2: _map
function _map(indexMap: Map<any, any>, value: number) {
var r = indexMap.get(value);
return isPresent(r) ? r : value;
}
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:4,代码来源:coalesce.ts
示例3: viewDestroyed
viewDestroyed(view: AppView) {
var viewId = _allIdsByView.get(view);
MapWrapper.delete(_allIdsByView, view);
MapWrapper.delete(_allViewsById, viewId);
}
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:5,代码来源:debug_element_view_listener.ts
示例4: onViewCreated
onViewCreated(view: AppView) {
var viewId = _nextId++;
_allViewsById.set(viewId, view);
_allIdsByView.set(view, viewId);
for (var i = 0; i < view.elementRefs.length; i++) {
var el = view.elementRefs[i];
_setElementId(this._renderer.getNativeElementSync(el), [viewId, i]);
}
}
开发者ID:hankduan,项目名称:angular,代码行数:9,代码来源:debug_element_view_listener.ts
示例5: inspectNativeElement
export function inspectNativeElement(element): DebugElement {
var elId = _getElementId(element);
if (isPresent(elId)) {
var view = _allViewsById.get(elId[0]);
if (isPresent(view)) {
return new DebugElement_(view, elId[1]);
}
}
return null;
}
开发者ID:hankduan,项目名称:angular,代码行数:10,代码来源:debug_element_view_listener.ts
示例6: remove
remove(key: string) {
if (!StringWrapper.contains(key, '.')) {
return this._data.delete(key);
}
var pieces = key.split('.');
var last = ListWrapper.last(pieces);
pieces.length = pieces.length - 1;
var target = this._resolve(pieces, this);
return target.remove(last);
}
开发者ID:hankduan,项目名称:angular,代码行数:10,代码来源:common.ts
示例7: onViewDestroyed
onViewDestroyed(view: AppView) {
var viewId = _allIdsByView.get(view);
_allIdsByView.delete(view);
_allViewsById.delete(viewId);
}
开发者ID:hankduan,项目名称:angular,代码行数:5,代码来源:debug_element_view_listener.ts
注:本文中的angular2/src/core/facade/collection.Map类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论