• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript core.platform函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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);
}
开发者ID:bjwyse,项目名称:universal,代码行数:33,代码来源:node.ts


示例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);
}
开发者ID:ImNitinNayar7,项目名称:nativescript-angular,代码行数:35,代码来源:application.ts


示例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);
}
开发者ID:aotv,项目名称:tabris-js-experiments,代码行数:35,代码来源:tabris-bootstrap.ts


示例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));
}
开发者ID:LordBinary,项目名称:angular,代码行数:7,代码来源:background_index.ts


示例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);
}
开发者ID:Caplu,项目名称:ng2-dribbble,代码行数:8,代码来源:browser.ts


示例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;
}
开发者ID:saikonda,项目名称:cruise-pas-public,代码行数:55,代码来源:bootstrap.ts


示例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);
}
开发者ID:kreo,项目名称:angular-2-bootstraping,代码行数:11,代码来源:browser_static.ts


示例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();

}
开发者ID:mkretz,项目名称:whrdpt-ui,代码行数:11,代码来源:customBootstrap.ts


示例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);
}
开发者ID:densitydesign,项目名称:strumentalia,代码行数:51,代码来源:bootstrap.ts


示例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)
  ]);
}
开发者ID:ldenman,项目名称:universal,代码行数:15,代码来源:browser.ts



注:本文中的angular2/core.platform函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript core.provide函数代码示例发布时间:2022-05-25
下一篇:
TypeScript core.getPlatform函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap