##// END OF EJS Templates
Merge with ioc ts support
Merge with ioc ts support

File last commit:

r115:691199f665e0 ioc ts support
r138:a2fb9af6341c merge v1.4.0-rc1 default
Show More
trace.ts
48 lines | 1.3 KiB | video/mp2t | TypeScriptLexer
cin
working on support commonjs modules format
r59 import { TraceSource } from "./TraceSource";
import { Predicate } from "../interfaces";
export = {
cin
fixed "singleton" activation type handling in container configuration...
r65 level: 0,
on(filter: any, cb: any) {
cin
working on support commonjs modules format
r59 if (arguments.length === 1) {
cb = filter;
filter = undefined;
}
cin
corrected code to support ts strict mode...
r115 let test: Predicate<string> | undefined;
cin
working on support commonjs modules format
r59 if (filter instanceof RegExp) {
test = chId => filter.test(chId);
} else if (filter instanceof Function) {
test = filter;
} else if (filter) {
test = chId => chId === filter;
}
if (test) {
TraceSource.on(source => {
cin
fixed "singleton" activation type handling in container configuration...
r65 source.level = this.level;
cin
corrected code to support ts strict mode...
r115 if (test && test(source.id))
cin
working on support commonjs modules format
r59 source.events.on(cb);
});
} else {
TraceSource.on(source => {
cin
fixed "singleton" activation type handling in container configuration...
r65 source.level = this.level;
cin
working on support commonjs modules format
r59 source.events.on(cb);
});
}
},
load(id: string, require: any, cb: (trace: TraceSource) => void) {
if (id) {
cb(TraceSource.get(id));
} else if (require.module && require.module.mid) {
cb(TraceSource.get(require.module.mid));
} else {
require(["module"], (module: { id: any; }) => {
cb(TraceSource.get(module && module.id));
});
}
},
dynamic: true
};