本文整理汇总了TypeScript中angular2/core.createPlatform函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createPlatform函数的具体用法?TypeScript createPlatform怎么用?TypeScript createPlatform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createPlatform函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: workerAppPlatform
export function workerAppPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_APP_PLATFORM));
}
return assertPlatform(WORKER_APP_PLATFORM_MARKER);
}
示例2: browserPlatform
export function browserPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
}
return assertPlatform(BROWSER_PLATFORM_MARKER);
}
示例3: importScripts
if (script.indexOf('http:') !== 0 || script.indexOf('https:') !== 0) {
script = '${window.location.origin}' + (script[0] === '/' ? script : '/' + script);
}
scripts[i] = script;
}
return importScripts_.apply(this, scripts);
};
importScripts('${VENDOR_NAME}.js', '${WORKER_APP_NAME}.js');
`], {
type: 'text/javascript'
}));
const appRef = createPlatform(ReflectiveInjector.resolveAndCreate([WORKER_RENDER_PLATFORM,
WORKER_RENDER_APPLICATION,
WORKER_RENDER_ROUTER,
provide(WORKER_SCRIPT, { useValue: workerScriptUrl })
]));
const worker = appRef.injector.get(WebWorkerInstance).worker;
worker.addEventListener('message', function onAppReady(event) {
if (event.data === 'APP_READY') {
worker.removeEventListener('message', onAppReady, false);
URL.revokeObjectURL(workerScriptUrl);
setTimeout(() => document.dispatchEvent(new Event('BootstrapComplete')));
}
}, false);
示例4: createPlatform
import {Component, createPlatform, coreLoadAndBootstrap, ReflectiveInjector} from 'angular2/core';
import {BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
var appProviders: any[] = [];
// #docregion longform
@Component({selector: 'my-app', template: 'Hello World'})
class MyApp {
}
var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
var appInjector =
ReflectiveInjector.resolveAndCreate([BROWSER_APP_PROVIDERS, appProviders], platform.injector);
coreLoadAndBootstrap(appInjector, MyApp);
// #enddocregion
示例5: beforeEach
beforeEach(() => {
document.body.innerHTML = "<test-app></test-app>";
let platform = createPlatform(ReflectiveInjector.resolveAndCreate(TEST_BROWSER_PLATFORM_PROVIDERS));
appInjector = ReflectiveInjector.resolveAndCreate([TEST_BROWSER_APPLICATION_PROVIDERS], platform.injector);
});