本文整理汇总了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}`);
}
}
示例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));
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例7: execute
execute(injector: Injector): void {
var params = ListWrapper.map(this._tokens, (t) => injector.get(t));
FunctionWrapper.apply(this._fn, params);
}
示例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);
}