本文整理匯總了TypeScript中@angular/core/src/di.Injector類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Injector類的具體用法?TypeScript Injector怎麽用?TypeScript Injector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Injector類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: initializeGenericWorkerRenderer
export function initializeGenericWorkerRenderer(injector: Injector) {
var bus = injector.get(MessageBus);
let zone = injector.get(NgZone);
bus.attachToZone(zone);
zone.runGuarded(() => {
WORKER_RENDER_MESSAGING_PROVIDERS.forEach((token) => { injector.get(token).start(); });
});
}
示例2: initWebWorkerApplication
function initWebWorkerApplication(injector: Injector): void {
var scriptUri: string;
try {
scriptUri = injector.get(WORKER_SCRIPT);
} catch (e) {
throw new BaseException(
"You must provide your WebWorker's initialization script with the WORKER_SCRIPT token");
}
let instance = injector.get(WebWorkerInstance);
spawnWebWorker(scriptUri, instance);
initializeGenericWorkerRenderer(injector);
}
示例3:
WORKER_RENDER_MESSAGING_PROVIDERS.forEach((token) => { injector.get(token).start(); });