本文整理汇总了TypeScript中angular2/src/facade/collection.List.push方法的典型用法代码示例。如果您正苦于以下问题:TypeScript List.push方法的具体用法?TypeScript List.push怎么用?TypeScript List.push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/facade/collection.List
的用法示例。
在下文中一共展示了List.push方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: coalesce
export function coalesce(records: ProtoRecord[]): ProtoRecord[] {
var res: List<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;
}
示例2: _addRecord
_addRecord(type, name, funcOrValue, args, fixedArgs, context) {
var selfIndex = this._records.length + 1;
if (context instanceof DirectiveIndex) {
this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context,
selfIndex, this._bindingRecord, this._expressionAsString,
false, false));
} else {
this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null,
selfIndex, this._bindingRecord, this._expressionAsString,
false, false));
}
return selfIndex;
}
示例3: go
go(url: string) {
url = this.normalizeAbsolutely(url);
if (this._path == url) {
return;
}
this._path = url;
this.urlChanges.push(url);
}
示例4: whenStable
whenStable(callback: Function) {
this._callbacks.push(callback);
if (this._pendingCount === 0) {
this._runCallbacks();
}
// TODO(juliemr) - hook into the zone api.
}
示例5: _appendRecords
_appendRecords(b: BindingRecord, variableNames: List<string>) {
if (b.isDirectiveLifecycle()) {
this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [],
[], -1, null, this.records.length + 1, b, null, false,
false));
} else {
_ConvertAstIntoProtoRecords.append(this.records, b, variableNames);
}
}
示例6: readPerfLog
readPerfLog(): Promise<any> {
this._commandLog.push('readPerfLog');
if (this._perfLogs.length > 0) {
var next = this._perfLogs[0];
ListWrapper.removeAt(this._perfLogs, 0);
return PromiseWrapper.resolve(next);
} else {
return PromiseWrapper.resolve([]);
}
}
示例7: _processStyleElement
_processStyleElement(current: CompileElement, control: CompileControl) {
var stylePromise = this._shadowDomStrategy.processStyleElement(
this._template.componentId, this._template.templateAbsUrl, current.element);
if (isPresent(stylePromise) && isPromise(stylePromise)) {
this._subTaskPromises.push(stylePromise);
}
// Style elements should not be further processed by the compiler, as they can not contain
// bindings. Skipping further compiler steps allow speeding up the compilation process.
control.ignoreCurrentElement();
}
示例8: coalesce
export function coalesce(records: List<ProtoRecord>): List<ProtoRecord> {
var res: List<ProtoRecord> = [];
var indexMap: Map<number, number> = MapWrapper.create();
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));
MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
} else if (isPresent(matchingRecord) && !record.lastInBinding) {
MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
} else {
res.push(record);
MapWrapper.set(indexMap, r.selfIndex, record.selfIndex);
}
}
return res;
}
示例9: constructor
constructor() {
var appSize = getIntParameter('appSize');
this.iterationCount = getIntParameter('iterationCount');
this.scrollIncrement = getIntParameter('scrollIncrement');
appSize = appSize > 1 ? appSize - 1 : 0; // draw at least one table
this.scrollAreas = [];
for (var i = 0; i < appSize; i++) {
this.scrollAreas.push(i);
}
bindAction('#run-btn', () => { this.runBenchmark(); });
bindAction('#reset-btn', () => {
this._getScrollDiv().scrollTop = 0;
var existingMarker = this._locateFinishedMarker();
if (isPresent(existingMarker)) {
DOM.removeChild(document.body, existingMarker);
}
});
}
示例10: add
add(thing: string) { this.log.push(thing); }