本文整理汇总了TypeScript中angular2/core.platform函数的典型用法代码示例。如果您正苦于以下问题:TypeScript platform函数的具体用法?TypeScript platform怎么用?TypeScript platform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: bootstrap
export function bootstrap(
appComponentType: Type,
customAppProviders: Array<any> = null,
customComponentProviders: Array<any> = null): Promise<ComponentRef> {
reflector.reflectionCapabilities = new ReflectionCapabilities();
let appProviders: Array<any> = [
...NODE_APPLICATION_PROVIDERS,
new Provider(DOCUMENT, {
useFactory: (directiveResolver) => {
// TODO(gdi2290): determine a better for document on the server
let selector = directiveResolver.resolve(appComponentType).selector;
let serverDocument = DOM.createHtmlDocument();
let el = DOM.createElement(selector);
DOM.appendChild(serverDocument.body, el);
return serverDocument;
},
deps: [DirectiveResolver]
}),
...(isPresent(customAppProviders) ? customAppProviders : [])
];
let componentProviders: Array<any> = [
...(isPresent(customComponentProviders) ? customComponentProviders : [])
];
return platform(NODE_PROVIDERS)
.application(appProviders)
.bootstrap(appComponentType, componentProviders);
}
示例2: bootstrap
export function bootstrap(appComponentType: any,
customProviders: ProviderArray = null): Promise<ComponentRef> {
NativeScriptDomAdapter.makeCurrent();
let platformProviders: ProviderArray = [
PLATFORM_COMMON_PROVIDERS,
];
let defaultAppProviders: ProviderArray = [
APPLICATION_COMMON_PROVIDERS,
FORM_PROVIDERS,
provide(PLATFORM_PIPES, {useValue: COMMON_PIPES, multi: true}),
provide(PLATFORM_DIRECTIVES, {useValue: COMMON_DIRECTIVES, multi: true}),
provide(PLATFORM_DIRECTIVES, {useValue: NS_DIRECTIVES, multi: true}),
provide(ExceptionHandler, {useFactory: () => new ExceptionHandler(DOM, true), deps: []}),
defaultPageProvider,
NativeScriptRootRenderer,
provide(RootRenderer, {useClass: NativeScriptRootRenderer}),
NativeScriptRenderer,
provide(Renderer, {useClass: NativeScriptRenderer}),
COMPILER_PROVIDERS,
provide(XHR, {useClass: FileSystemXHR}),
]
var appProviders = [defaultAppProviders];
if (isPresent(customProviders)) {
appProviders.push(customProviders);
}
if (!_platform) {
_platform = platform(platformProviders);
}
return _platform.application(appProviders).bootstrap(appComponentType);
}
示例3: bootstrap
export function bootstrap(appComponentType: any, tabrisProviders: Provider[] = null): Promise<ComponentRef> {
TabrisDomAdapter.makeCurrent();
let logger = {
logGroup: () => {
console.log('---');
},
logError: (error) => {
console.error(error);
},
logGroupEnd: () => {
console.log('---');
}
};
let platformProviders = [
PLATFORM_COMMON_PROVIDERS,
provide(XHR, {useClass: XHRShim}),
provide(ExceptionHandler, {useFactory: () => new ExceptionHandler(logger, true), deps: []})
];
let appProviders = [
APPLICATION_COMMON_PROVIDERS,
COMPILER_PROVIDERS,
TabrisRootRenderer,
provide(RootRenderer, {useClass: TabrisRootRenderer}),
TabrisRenderer,
provide(Renderer, {useClass: TabrisRenderer})
];
if (tabrisProviders) {
appProviders.push(tabrisProviders);
}
return platform(platformProviders).application(appProviders).bootstrap(appComponentType);
}
示例4: main
export function main() {
let refPromise = platform([WORKER_APP_PLATFORM]).asyncApplication(null, [
WORKER_APP_APPLICATION, WORKER_APP_ROUTER,
new Provider(LocationStrategy, {useClass: HashLocationStrategy})
]);
refPromise.then((ref) => ref.bootstrap(App));
}
示例5: bootstrap
export function bootstrap(
appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef> {
reflector.reflectionCapabilities = new ReflectionCapabilities();
let appProviders =
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
}
示例6: fuseBootstraper
export function fuseBootstraper(customProviders: ProviderArray = null): ApplicationRef {
FuseDomAdapter.makeCurrent();
let platformProviders: ProviderArray = [
PLATFORM_COMMON_PROVIDERS
];
let defaultAppProviders: ProviderArray = [
FuseRenderer,
provide(Renderer, {
useClass: FuseRenderer
}),
FuseRootRenderer,
provide(RootRenderer, {
useClass: FuseRootRenderer
}),
provide(XHR, {
useClass: FileSystemXHR
}),
provide(ExceptionHandler, {
useFactory: () => new ExceptionHandler(DOM, true),
deps: []
}),
provide(PLATFORM_PIPES, {
useValue: COMMON_PIPES,
multi: true
}),
provide(PLATFORM_DIRECTIVES, {
useValue: COMMON_DIRECTIVES,
multi: true
}),
APPLICATION_COMMON_PROVIDERS,
COMPILER_PROVIDERS,
FORM_PROVIDERS,
HTTP_PROVIDERS,
ROUTER_PROVIDERS,
bind(LocationStrategy).toClass(FuseLocationStrategy)
// ROUTER_PROVIDERS,
// provide(LocationStrategy, {
// useClass: FuseLocationStrategy
// })
];
let appProviders = [defaultAppProviders];
if (isPresent(customProviders)) {
appProviders.push(customProviders);
}
if (!_platform) {
_platform = platform(platformProviders);
}
let app = _platform.application(appProviders);
return app;
}
示例7: bootstrapStatic
export function bootstrapStatic(appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>,
initReflector?: Function): Promise<ComponentRef> {
if (isPresent(initReflector)) {
initReflector();
}
let appProviders =
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
}
示例8: customBootstrap
export function customBootstrap(appComponentType, customProviders) {
reflector.reflectionCapabilities = new ReflectionCapabilities();
let appProviders =
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
var app = platform(BROWSER_PROVIDERS).application(appProviders);
var service = app.injector.get(ConfigService);
return service.getAppConfig().flatMap((data) => {
return app.bootstrap(appComponentType, [ new Provider('config', { useValue: data }) ] );
}).toPromise();
}
示例9: fuseBootstraper
export function fuseBootstraper(customProviders: ProviderArray = null): ApplicationRef { //Promise<ComponentRef> {//appComponentType: any,
FuseDomAdapter.makeCurrent();
let fuseProviders: ProviderArray = [
FuseRenderer,
provide(Renderer, {
useClass: FuseRenderer
}),
FuseRootRenderer,
provide(RootRenderer, {
useClass: FuseRootRenderer
}),
provide(XHR, {
useClass: FileSystemXHR
}),
provide(ExceptionHandler, {
useFactory: () => new ExceptionHandler(DOM, true),
deps: []
}),
provide(PLATFORM_PIPES, {
useValue: COMMON_PIPES,
multi: true
}),
provide(PLATFORM_DIRECTIVES, {
useValue: COMMON_DIRECTIVES,
multi: true
}),
APPLICATION_COMMON_PROVIDERS,
COMPILER_PROVIDERS,
PLATFORM_COMMON_PROVIDERS,
FORM_PROVIDERS,
HTTP_PROVIDERS,
JSONP_PROVIDERS
];
let appProviders = [
ROUTER_PROVIDERS,
provide(LocationStrategy, {
useClass: FuseLocationStrategy
})
];
if (isPresent(customProviders)) {
appProviders.push(customProviders);
}
let app = platform(fuseProviders).application(appProviders);
return app; //.bootstrap(appComponentType);
}
示例10: main
export function main() {
var app = angular.platform(BROWSER_PROVIDERS)
.application([
BROWSER_APP_PROVIDERS,
HTTP_PROVIDERS,
/*
NG_PRELOAD_CACHE_PROVIDERS,
bind(PRIME_CACHE).toValue(true)
*/
]);
return Promise.all([
app.bootstrap(App),
app.bootstrap(MyApp)
]);
}