当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript core.createPlatform函数代码示例

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

示例2: browserPlatform

export function browserPlatform(): PlatformRef {
  if (isBlank(getPlatform())) {
    createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
  }
  return assertPlatform(BROWSER_PLATFORM_MARKER);
}
开发者ID:844496869,项目名称:angular,代码行数:6,代码来源:browser.ts

示例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);
开发者ID:morriq,项目名称:angular2-universal-starter,代码行数:30,代码来源:boot_worker.ts

示例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
开发者ID:844496869,项目名称:angular,代码行数:15,代码来源:platform.ts

示例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);
 });
开发者ID:laco0416,项目名称:angular2-browserify-deps,代码行数:5,代码来源:index.spec.ts


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