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


TypeScript List.map方法代码示例

本文整理汇总了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}`);
 }
开发者ID:AsherBarak,项目名称:angular,代码行数:3,代码来源:change_detection_jit_generator.ts

示例2: _genLocalDefinitions

 _genLocalDefinitions(): string { return this._localNames.map((n) => `var ${n};`).join("\n"); }
开发者ID:AsherBarak,项目名称:angular,代码行数:1,代码来源:change_detection_jit_generator.ts

示例3: _genChangeDefinitions

 _genChangeDefinitions(): string {
   return this._changeNames.map((n) => `var ${n} = false;`).join("\n");
 }
开发者ID:AsherBarak,项目名称:angular,代码行数:3,代码来源:change_detection_jit_generator.ts

示例4: _genGetDirectiveFieldNames

 _genGetDirectiveFieldNames(): List<string> {
   return this.directiveRecords.map(d => this._genGetDirective(d.directiveIndex));
 }
开发者ID:AsherBarak,项目名称:angular,代码行数:3,代码来源:change_detection_jit_generator.ts

示例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);
  }
开发者ID:cedriclam,项目名称:angular,代码行数:74,代码来源:change_detection_jit_generator.ts

示例6: _getPipeNames

 _getPipeNames(_localNames: List<string>): List<string> {
   return _localNames.map((n) => `this.${n}_pipe`);
 }
开发者ID:cedriclam,项目名称:angular,代码行数:3,代码来源:change_detection_jit_generator.ts

示例7: _getFieldNames

 _getFieldNames(_localNames: List<string>): List<string> {
   return _localNames.map((n) => `this.${n}`);
 }
开发者ID:cedriclam,项目名称:angular,代码行数:3,代码来源:change_detection_jit_generator.ts

示例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);
 }
开发者ID:cedriclam,项目名称:angular,代码行数:5,代码来源:change_detection_jit_generator.ts


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