chore(build): migrated di to TypeScript

This commit is contained in:
vsavkin
2015-04-24 15:19:11 -07:00
parent 649e276610
commit cb87fa0970
22 changed files with 318 additions and 332 deletions

View File

@ -0,0 +1 @@
library util_decorators;

View File

@ -1,12 +1,16 @@
export var __esModule = true;
import {global} from 'angular2/src/facade/lang';
export function makeDecorator(annotationCls) {
return function(...args) {
return function() {
var args = arguments;
var Reflect = global.Reflect;
if (!(Reflect && Reflect.getMetadata)) {
throw 'reflect-metadata shim is required when using class decorators';
}
var annotationInstance = new annotationCls(...args);
var annotationInstance = Object.create(annotationCls);
annotationInstance.call(annotationInstance, args);
return function(cls) {
var annotations = Reflect.getMetadata('annotations', cls);
annotations = annotations || [];
@ -18,12 +22,14 @@ export function makeDecorator(annotationCls) {
}
export function makeParamDecorator(annotationCls) {
return function(...args) {
return function() {
var args = arguments;
var Reflect = global.Reflect;
if (!(Reflect && Reflect.getMetadata)) {
throw 'reflect-metadata shim is required when using parameter decorators';
}
var annotationInstance = new annotationCls(...args);
var annotationInstance = Object.create(annotationCls);
annotationInstance.call(annotationInstance, args);
return function(cls, unusedKey, index) {
var parameters = Reflect.getMetadata('parameters', cls);
parameters = parameters || [];