本文整理匯總了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);
});