本文整理汇总了TypeScript中angular2/src/facade/collection.List.map方法的典型用法代码示例。如果您正苦于以下问题:TypeScript List.map方法的具体用法?TypeScript List.map怎么用?TypeScript List.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/facade/collection.List
的用法示例。
在下文中一共展示了List.map方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _getChangeNames
_getChangeNames(_localNames: List<string>): List<string> {
return _localNames.map((n) => `change_${n}`);
}
示例2: _genLocalDefinitions
_genLocalDefinitions(): string { return this._localNames.map((n) => `var ${n};`).join("\n"); }
示例3: _genChangeDefinitions
_genChangeDefinitions(): string {
return this._changeNames.map((n) => `var ${n} = false;`).join("\n");
}
示例4: _genGetDirectiveFieldNames
_genGetDirectiveFieldNames(): List<string> {
return this.directiveRecords.map(d => this._genGetDirective(d.directiveIndex));
}
示例5: generate
generate(): Function {
var typeName = _sanitizeName(`ChangeDetector_${this.id}`);
var classDefinition = `
var ${typeName} = function ${typeName}(dispatcher, pipeRegistry, protos, directiveRecords) {
${ABSTRACT_CHANGE_DETECTOR}.call(this, ${JSON.stringify(this.id)});
${DISPATCHER_ACCESSOR} = dispatcher;
${PIPE_REGISTRY_ACCESSOR} = pipeRegistry;
${PROTOS_ACCESSOR} = protos;
${DIRECTIVES_ACCESSOR} = directiveRecords;
${LOCALS_ACCESSOR} = null;
${CURRENT_PROTO} = null;
${ALREADY_CHECKED_ACCESSOR} = false;
${this._genFieldDefinitions()}
}
${typeName}.prototype = Object.create(${ABSTRACT_CHANGE_DETECTOR}.prototype);
${typeName}.prototype.detectChangesInRecords = function(throwOnChange) {
if (!this.hydrated()) {
${UTIL}.throwDehydrated();
}
try {
this.__detectChangesInRecords(throwOnChange);
} catch (e) {
this.throwError(${CURRENT_PROTO}, e, e.stack);
}
}
${typeName}.prototype.__detectChangesInRecords = function(throwOnChange) {
${CURRENT_PROTO} = null;
${this._genLocalDefinitions()}
${this._genChangeDefinitions()}
var ${IS_CHANGED_LOCAL} = false;
var ${CHANGES_LOCAL} = null;
context = ${CONTEXT_ACCESSOR};
${this.records.map((r) => this._genRecord(r)).join("\n")}
${ALREADY_CHECKED_ACCESSOR} = true;
}
${typeName}.prototype.callOnAllChangesDone = function() {
${this._genCallOnAllChangesDoneBody()}
}
${typeName}.prototype.hydrate = function(context, locals, directives) {
${MODE_ACCESSOR} = "${ChangeDetectionUtil.changeDetectionMode(this.changeDetectionStrategy)}";
${CONTEXT_ACCESSOR} = context;
${LOCALS_ACCESSOR} = locals;
${this._genHydrateDirectives()}
${this._genHydrateDetectors()}
${ALREADY_CHECKED_ACCESSOR} = false;
}
${typeName}.prototype.dehydrate = function() {
${this._genPipeOnDestroy()}
${this._genFieldDefinitions()}
${LOCALS_ACCESSOR} = null;
}
${typeName}.prototype.hydrated = function() {
return ${CONTEXT_ACCESSOR} !== null;
}
return function(dispatcher, pipeRegistry) {
return new ${typeName}(dispatcher, pipeRegistry, protos, directiveRecords);
}
`;
return new Function('AbstractChangeDetector', 'ChangeDetectionUtil', 'protos',
'directiveRecords', classDefinition)(
AbstractChangeDetector, ChangeDetectionUtil, this.records, this.directiveRecords);
}
示例6: _getPipeNames
_getPipeNames(_localNames: List<string>): List<string> {
return _localNames.map((n) => `this.${n}_pipe`);
}
示例7: _getFieldNames
_getFieldNames(_localNames: List<string>): List<string> {
return _localNames.map((n) => `this.${n}`);
}
示例8: _getLocalNames
_getLocalNames(records: List<ProtoRecord>): List<string> {
var index = 0;
var names = records.map((r) => { return _sanitizeName(`${r.name}${index++}`); });
return ["context"].concat(names);
}