config.ts
23 lines
| 866 B
| video/mp2t
|
TypeScriptLexer
|
|
r134 | import { Services } from "./services"; | ||
| import { configure } from "../di/traits"; | ||||
| import { LifetimeManager } from "../di/LifetimeManager"; | ||||
|
|
r110 | |||
|
|
r134 | export const config = configure<Services>() | ||
|
|
r133 | .register("host", s => s.value("example.com")) | ||
| .register("bar2", bar2 => Promise.all([import("./Foo"), import("./Bar")]) | ||||
| .then(([{ Foo }, { Bar }]) => { | ||||
|
|
r134 | const lifetime = LifetimeManager.hierarchyLifetime(); | ||
|
|
r133 | bar2.factory((resolve, activate) => { | ||
| const bar = new Bar({ | ||||
| foo: activate(lifetime, () => new Foo()), | ||||
| nested: { | ||||
| lazy: resolve("foo", { lazy: true }) | ||||
| }, | ||||
| host: resolve("host") | ||||
| }, "some text"); | ||||
| bar.setName(resolve("host")); | ||||
| return bar; | ||||
| }); | ||||
| }) | ||||
|
|
r125 | ); | ||
