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

TypeScript core.createPlatformFactory函数代码示例

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

本文整理汇总了TypeScript中@angular/core.createPlatformFactory函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createPlatformFactory函数的具体用法?TypeScript createPlatformFactory怎么用?TypeScript createPlatformFactory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了createPlatformFactory函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: analyzeAppProvidersForDeprecatedConfiguration

    [(appProviders: any[]) => {
      const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(appProviders);
      const platformRef = createPlatformFactory(platformServerTesting, 'serverTestingDeprecated', [{
                                                  provide: CompilerOptions,
                                                  useValue: deprecatedConfiguration.compilerOptions,
                                                  multi: true
                                                }])();

      @NgModule({
        exports: [ServerTestingModule],
        declarations: [deprecatedConfiguration.moduleDeclarations]
      })
      class DynamicTestModule {
      }

      const testInjector = initTestEnvironment(DynamicTestModule, platformRef);
      const console: Console = testInjector.get(Console);
      deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
    }];
开发者ID:FancyAcc,项目名称:angular,代码行数:19,代码来源:server.ts


示例2: messageBusFactory

}

function messageBusFactory(instance: WebWorkerInstance): MessageBus {
  return instance.bus;
}

function initWebWorkerRenderPlatform(): void {
  BrowserDomAdapter.makeCurrent();
  wtfInit();
  BrowserGetTestability.init();
}

/**
 * @experimental WebWorker support is currently experimental.
 */
export const workerUiPlatform = createPlatformFactory('workerUi', WORKER_UI_PLATFORM_PROVIDERS);

function _exceptionHandler(): ExceptionHandler {
  return new ExceptionHandler(getDOM());
}

function _document(): any {
  return getDOM().defaultDoc();
}

function initWebWorkerAppFn(injector: Injector): () => void {
  return () => {
    var scriptUri: string;
    try {
      scriptUri = injector.get(WORKER_SCRIPT);
    } catch (e) {
开发者ID:AudreyChao,项目名称:angular,代码行数:31,代码来源:worker_render.ts


示例3: createPlatformFactory

import {Compiler, CompilerFactory, CompilerOptions, NgModule, PlatformRef, Provider, ReflectiveInjector, Type, createPlatform, createPlatformFactory} from '@angular/core';
import {TestComponentBuilder, TestComponentRenderer, initTestEnvironment} from '@angular/core/testing';
import {BrowserTestingModule, browserTestingPlatform} from '@angular/platform-browser/testing';

import {Console} from './core_private';
import {browserDynamicPlatform} from './index';
import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers';
import {DOMTestComponentRenderer} from './testing/dom_test_component_renderer';

export * from './private_export_testing'

/**
 * @experimental API related to bootstrapping are still under review.
 */
export const browserDynamicTestingPlatform = createPlatformFactory(
    coreDynamicTestingPlatform, 'browserDynamicTesting',
    INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);

/**
 * NgModule for testing.
 *
 * @stable
 */
@NgModule({
  exports: [BrowserTestingModule],
  providers: [
    {provide: TestComponentBuilder, useClass: OverridingTestComponentBuilder},
    {provide: TestComponentRenderer, useClass: DOMTestComponentRenderer},
  ]
})
export class BrowserDynamicTestingModule {
开发者ID:alexbell1,项目名称:angular,代码行数:31,代码来源:testing.ts


示例4: createPlatformFactory

import {platformCoreDynamicTesting} from '@angular/compiler/testing';
import {ClassProvider, ExistingProvider, FactoryProvider, NgModule, PlatformRef, Provider, TypeProvider, ValueProvider, createPlatformFactory} from '@angular/core';
import {TestComponentRenderer} from '@angular/core/testing';
import {BrowserTestingModule} from '@angular/platform-browser/testing';

import {DOMTestComponentRenderer} from './dom_test_component_renderer';
import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './private_import_platform-browser-dynamic';

export * from './private_export_testing'

/**
 * @stable
 */
export const platformBrowserDynamicTesting = createPlatformFactory(
    platformCoreDynamicTesting, 'browserDynamicTesting',
    INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);

/**
 * NgModule for testing.
 *
 * @stable
 */
@NgModule({
  exports: [BrowserTestingModule],
  providers: [
    {provide: TestComponentRenderer, useClass: DOMTestComponentRenderer},
  ]
})
export class BrowserDynamicTestingModule {
}
开发者ID:JanStureNielsen,项目名称:angular,代码行数:30,代码来源:index.ts


示例5: createPlatformFactory

  {provide: DOCUMENT, useFactory: _document, deps: []},
  {provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true},
  {provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true},
  {provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true},
  {provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig},
  {provide: DomRootRenderer, useClass: DomRootRenderer_},
  {provide: RootRenderer, useExisting: DomRootRenderer},
  {provide: SharedStylesHost, useExisting: DomSharedStylesHost},
  {provide: AnimationDriver, useFactory: _resolveDefaultAnimationDriver}, DomSharedStylesHost,
  Testability, EventManager, ELEMENT_PROBE_PROVIDERS
];

/**
 * @experimental API related to bootstrapping are still under review.
 */
export const browserPlatform = createPlatformFactory('browser', BROWSER_PLATFORM_PROVIDERS);

export function initDomAdapter() {
  BrowserDomAdapter.makeCurrent();
  wtfInit();
  BrowserGetTestability.init();
}

export function _exceptionHandler(): ExceptionHandler {
  return new ExceptionHandler(getDOM());
}

export function _document(): any {
  return getDOM().defaultDoc();
}
开发者ID:AudreyChao,项目名称:angular,代码行数:30,代码来源:browser.ts


示例6: initParse5Adapter

const SERVER_DYNAMIC_PROVIDERS: any[] = [
  SERVER_PLATFORM_PROVIDERS,
  {provide: CompilerFactory, useValue: BROWSER_DYNAMIC_TEST_COMPILER_FACTORY},
];


function initParse5Adapter() {
  Parse5DomAdapter.makeCurrent();
  wtfInit();
}

/**
 * @experimental
 */
export const serverPlatform = createPlatformFactory('server', SERVER_PLATFORM_PROVIDERS);

/**
 * The server platform that supports the runtime compiler.
 *
 * @experimental
 */
export const serverDynamicPlatform =
    createPlatformFactory('serverDynamic', SERVER_DYNAMIC_PROVIDERS);

/**
 * Used to bootstrap Angular in server environment (such as node).
 *
 * This version of bootstrap only creates platform injector and does not define anything for
 * application injector. It is expected that application providers are imported from other
 * packages such as `@angular/platform-browser` or `@angular/platform-browser-dynamic`.
开发者ID:AudreyChao,项目名称:angular,代码行数:30,代码来源:server.ts


示例7: BaseException

      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);
  };
}

/**
 * @experimental WebWorker support is currently experimental.
 */
export const platformWorkerUi =
    createPlatformFactory(platformCore, 'workerUi', _WORKER_UI_PLATFORM_PROVIDERS);

/**
 * @deprecated Use {@link platformWorkerUi} instead
 */
export const workerUiPlatform = platformWorkerUi;


function _exceptionHandler(): ExceptionHandler {
  return new ExceptionHandler(getDOM());
}

function _document(): any {
  return getDOM().defaultDoc();
}
开发者ID:AngularLovers,项目名称:angular,代码行数:30,代码来源:worker_render.ts


示例8: createPlatformFactory

export const platformDynamicNode = (extraProviders?: any[]) => {
  const platform = __PLATFORM_REF || createPlatformFactory(platformCoreDynamic, 'nodeDynamic', INTERNAL_NODE_PLATFORM_PROVIDERS)(extraProviders);
  return new NodePlatform(platform);
}
开发者ID:setohe0909,项目名称:universal,代码行数:4,代码来源:index.ts


示例9: createPlatformFactory

} from '@angular/compiler';

import {PLATFORM_COLLECTOR_PROVIDERS} from './collectors';
import {PLATFORM_RESOURCE_LOADER_PROVIDERS} from './resource-loader';

import {ServerPlatform} from './platform';

import {randomizedApplicationId} from '../static';

const baseProviders: Array<Provider> = [
  ...PLATFORM_COLLECTOR_PROVIDERS,
  {provide: APP_ID, useFactory: randomizedApplicationId},
  {provide: PlatformRef, useClass: ServerPlatform},
];

export const createStaticPlatform = createPlatformFactory(platformCore, 'node/static', baseProviders);

const jitProviders: Array<Provider> = [
  COMPILER_PROVIDERS,
  {
    provide: COMPILER_OPTIONS,
    useValue: {providers: [
      ...PLATFORM_RESOURCE_LOADER_PROVIDERS,
    ]},
    multi: true,
  },
  ...baseProviders,
];

export const createJitPlatform = createPlatformFactory(platformCoreDynamic, 'node/jit', jitProviders);
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:30,代码来源:factory.ts


示例10: createPlatformFactory

/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */

import {COMPILER_OPTIONS, CompilerFactory, PlatformRef, StaticProvider, createPlatformFactory, platformCore} from '@angular/core';
import {JitCompilerFactory} from './compiler_factory';

/**
 * A platform that included corePlatform and the compiler.
 *
 * @publicApi
 */
export const platformCoreDynamic = createPlatformFactory(platformCore, 'coreDynamic', [
  {provide: COMPILER_OPTIONS, useValue: {}, multi: true},
  {provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]},
]);
开发者ID:Cammisuli,项目名称:angular,代码行数:20,代码来源:platform_core_dynamic.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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