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


TypeScript FunctionWrapper.apply方法代码示例

本文整理汇总了TypeScript中angular2/src/facade/lang.FunctionWrapper.apply方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FunctionWrapper.apply方法的具体用法?TypeScript FunctionWrapper.apply怎么用?TypeScript FunctionWrapper.apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/src/facade/lang.FunctionWrapper的用法示例。


在下文中一共展示了FunctionWrapper.apply方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: _calculateCurrValue

  _calculateCurrValue(proto: ProtoRecord) {
    switch (proto.mode) {
      case RECORD_TYPE_SELF:
        return this._readContext(proto);

      case RECORD_TYPE_CONST:
        return proto.funcOrValue;

      case RECORD_TYPE_PROPERTY:
        var context = this._readContext(proto);
        return proto.funcOrValue(context);

      case RECORD_TYPE_LOCAL:
        return this.locals.get(proto.name);

      case RECORD_TYPE_INVOKE_METHOD:
        var context = this._readContext(proto);
        var args = this._readArgs(proto);
        return proto.funcOrValue(context, args);

      case RECORD_TYPE_KEYED_ACCESS:
        var arg = this._readArgs(proto)[0];
        return this._readContext(proto)[arg];

      case RECORD_TYPE_INVOKE_CLOSURE:
        return FunctionWrapper.apply(this._readContext(proto), this._readArgs(proto));

      case RECORD_TYPE_INTERPOLATE:
      case RECORD_TYPE_PRIMITIVE_OP:
        return FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto));

      default:
        throw new BaseException(`Unknown operation ${proto.mode}`);
    }
  }
开发者ID:Dineshchse,项目名称:angular,代码行数:35,代码来源:dynamic_change_detector.ts

示例2: eval

 eval(context:any, locals:any):any {
   var obj = this.target.eval(context, locals);
   if (! (obj instanceof Function)) {
     throw new BaseException(`${obj} is not a function`);
   }
   return FunctionWrapper.apply(obj, evalList(context, locals, this.args));
 }
开发者ID:tavwizard,项目名称:angular,代码行数:7,代码来源:ast.ts

示例3: _findOrCreate

 _findOrCreate(key: Key, binding: ResolvedBinding, deps: List<any>) {
   try {
     var instance = this.injector._getInstance(key);
     if (!_isWaiting(instance)) return instance;
     return FunctionWrapper.apply(binding.factory, deps);
   } catch (e) {
     this.injector._clear(key);
     throw new InstantiationError(e, key);
   }
 }
开发者ID:Muthamizhan,项目名称:angular,代码行数:10,代码来源:injector.ts

示例4: _createInstance

 _createInstance(key: Key, binding: ResolvedBinding, deps: List<any>) {
   try {
     var instance = FunctionWrapper.apply(binding.factory, deps);
     this.injector._setInstance(key, instance);
     return instance;
   } catch (e) {
     this.injector._clear(key);
     throw new InstantiationError(e, key);
   }
 }
开发者ID:Muthamizhan,项目名称:angular,代码行数:10,代码来源:injector.ts

示例5: eval

 eval(context, locals) {
   var evaluatedArgs = evalList(context, locals, this.args);
   if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) {
     var fn = locals.get(this.name);
     return FunctionWrapper.apply(fn, evaluatedArgs);
   } else {
     var evaluatedReceiver = this.receiver.eval(context, locals);
     return this.fn(evaluatedReceiver, evaluatedArgs);
   }
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:10,代码来源:ast.ts

示例6: _findOrCreate

 _findOrCreate(key, binding, deps) {
   try {
     var instance = this.injector._getInstance(key);
     if (!_isWaiting(instance))
       return instance;
     return FunctionWrapper.apply(binding.factory, deps);
   } catch (e) {
       console.log("_findOrCreate", e.stack);
     this.injector._clear(key);
     throw new InstantiationError(e, key);
   }
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:12,代码来源:injector.ts

示例7: execute

 execute(injector: Injector): void {
   var params = ListWrapper.map(this._tokens, (t) => injector.get(t));
   FunctionWrapper.apply(this._fn, params);
 }
开发者ID:Mariem-07,项目名称:angular,代码行数:4,代码来源:test_injector.ts

示例8: execute

 /**
  * Returns the value of the executed function.
  */
 execute(injector: Injector): any {
   var params = this._tokens.map(t => injector.get(t));
   return FunctionWrapper.apply(this._fn, params);
 }
开发者ID:Caplu,项目名称:ng2-dribbble,代码行数:7,代码来源:test_injector.ts


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