Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* A list of {@link Provider}s. To use the router in a Worker enabled application you must
* include these providers when setting up the render thread.
*/
export const WORKER_RENDER_ROUTER = CONST_EXPR([BrowserPlatformLocation]);
export const WORKER_RENDER_APPLICATION_COMMON = CONST_EXPR([
APPLICATION_COMMON_PROVIDERS,
WORKER_RENDER_MESSAGING_PROVIDERS,
new Provider(ExceptionHandler, { useFactory: _exceptionHandler, deps: [] }),
new Provider(DOCUMENT, { useFactory: _document, deps: [] }),
// TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread
// #5298
new Provider(EVENT_MANAGER_PLUGINS, { useClass: DomEventsPlugin, multi: true }),
new Provider(EVENT_MANAGER_PLUGINS, { useClass: KeyEventsPlugin, multi: true }),
new Provider(EVENT_MANAGER_PLUGINS, { useClass: HammerGesturesPlugin, multi: true }),
new Provider(HAMMER_GESTURE_CONFIG, { useClass: HammerGestureConfig }),
new Provider(DomRootRenderer, { useClass: DomRootRenderer_ }),
new Provider(RootRenderer, { useExisting: DomRootRenderer }),
new Provider(SharedStylesHost, { useExisting: DomSharedStylesHost }),
new Provider(XHR, { useClass: XHRImpl }),
MessageBasedXHRImpl,
new Provider(ServiceMessageBrokerFactory, { useClass: ServiceMessageBrokerFactory_ }),
new Provider(ClientMessageBrokerFactory, { useClass: ClientMessageBrokerFactory_ }),
Serializer,
new Provider(ON_WEB_WORKER, { useValue: false }),
RenderStore,
DomSharedStylesHost,
Testability,
BrowserDetails,
AnimationBuilder,
EventManager
]);
* include these providers when setting up the render thread.
*/
exports.WORKER_RENDER_ROUTER = lang_1.CONST_EXPR([browser_platform_location_1.BrowserPlatformLocation]);
exports.WORKER_RENDER_APPLICATION_COMMON = lang_1.CONST_EXPR([
core_1.APPLICATION_COMMON_PROVIDERS,
exports.WORKER_RENDER_MESSAGING_PROVIDERS,
new di_1.Provider(core_1.ExceptionHandler, { useFactory: _exceptionHandler, deps: [] }),
new di_1.Provider(dom_tokens_1.DOCUMENT, { useFactory: _document, deps: [] }),
// TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread
// #5298
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: dom_events_1.DomEventsPlugin, multi: true }),
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: key_events_1.KeyEventsPlugin, multi: true }),
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: hammer_gestures_1.HammerGesturesPlugin, multi: true }),
new di_1.Provider(dom_renderer_1.DomRootRenderer, { useClass: dom_renderer_1.DomRootRenderer_ }),
new di_1.Provider(core_1.RootRenderer, { useExisting: dom_renderer_1.DomRootRenderer }),
new di_1.Provider(shared_styles_host_2.SharedStylesHost, { useExisting: shared_styles_host_1.DomSharedStylesHost }),
new di_1.Provider(compiler_1.XHR, { useClass: xhr_impl_1.XHRImpl }),
xhr_impl_2.MessageBasedXHRImpl,
new di_1.Provider(service_message_broker_1.ServiceMessageBrokerFactory, { useClass: service_message_broker_1.ServiceMessageBrokerFactory_ }),
new di_1.Provider(client_message_broker_1.ClientMessageBrokerFactory, { useClass: client_message_broker_1.ClientMessageBrokerFactory_ }),
serializer_1.Serializer,
new di_1.Provider(api_1.ON_WEB_WORKER, { useValue: false }),
render_store_1.RenderStore,
shared_styles_host_1.DomSharedStylesHost,
testability_1.Testability,
browser_details_1.BrowserDetails,
animation_builder_1.AnimationBuilder,
common_dom_1.EventManager
]);
function initializeGenericWorkerRenderer(injector) {
var bus = injector.get(message_bus_1.MessageBus);
var zone = injector.get(ng_zone_1.NgZone);
APPLICATION_COMMON_PROVIDERS,
WORKER_RENDER_MESSAGING_PROVIDERS,
new Provider(ExceptionHandler, {useFactory: _exceptionHandler, deps: []}),
new Provider(DOCUMENT, {useFactory: _document, deps: []}),
// TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread
// #5298
new Provider(EVENT_MANAGER_PLUGINS, {useClass: DomEventsPlugin, multi: true}),
new Provider(EVENT_MANAGER_PLUGINS, {useClass: KeyEventsPlugin, multi: true}),
new Provider(EVENT_MANAGER_PLUGINS, {useClass: HammerGesturesPlugin, multi: true}),
new Provider(DomRootRenderer, {useClass: DomRootRenderer_}),
new Provider(RootRenderer, {useExisting: DomRootRenderer}),
new Provider(SharedStylesHost, {useExisting: DomSharedStylesHost}),
new Provider(XHR, {useClass: XHRImpl}),
new Provider(MessageBus, {useFactory:createMessageBus, deps: [NgZone]}),
MessageBasedXHRImpl,
new Provider(ServiceMessageBrokerFactory, {useClass: ServiceMessageBrokerFactory_}),
new Provider(ClientMessageBrokerFactory, {useClass: ClientMessageBrokerFactory_}),
Serializer,
new Provider(ON_WEB_WORKER, {useValue: false}),
RenderStore,
DomSharedStylesHost,
Testability,
BrowserDetails,
AnimationBuilder,
EventManager
]);
export function initializeGenericWorkerRenderer(injector: Injector) {
var bus = injector.get(MessageBus);
let zone = injector.get(NgZone);
bus.attachToZone(zone);
/**
* A list of {@link Provider}s. To use the router in a Worker enabled application you must
* include these providers when setting up the render thread.
*/
exports.WORKER_RENDER_ROUTER = lang_1.CONST_EXPR([browser_platform_location_1.BrowserPlatformLocation]);
exports.WORKER_RENDER_APPLICATION_COMMON = lang_1.CONST_EXPR([
core_1.APPLICATION_COMMON_PROVIDERS,
exports.WORKER_RENDER_MESSAGING_PROVIDERS,
new di_1.Provider(core_1.ExceptionHandler, { useFactory: _exceptionHandler, deps: [] }),
new di_1.Provider(dom_tokens_1.DOCUMENT, { useFactory: _document, deps: [] }),
// TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread
// #5298
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: dom_events_1.DomEventsPlugin, multi: true }),
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: key_events_1.KeyEventsPlugin, multi: true }),
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: hammer_gestures_1.HammerGesturesPlugin, multi: true }),
new di_1.Provider(dom_renderer_1.DomRootRenderer, { useClass: dom_renderer_1.DomRootRenderer_ }),
new di_1.Provider(core_1.RootRenderer, { useExisting: dom_renderer_1.DomRootRenderer }),
new di_1.Provider(shared_styles_host_2.SharedStylesHost, { useExisting: shared_styles_host_1.DomSharedStylesHost }),
new di_1.Provider(compiler_1.XHR, { useClass: xhr_impl_1.XHRImpl }),
xhr_impl_2.MessageBasedXHRImpl,
new di_1.Provider(service_message_broker_1.ServiceMessageBrokerFactory, { useClass: service_message_broker_1.ServiceMessageBrokerFactory_ }),
new di_1.Provider(client_message_broker_1.ClientMessageBrokerFactory, { useClass: client_message_broker_1.ClientMessageBrokerFactory_ }),
serializer_1.Serializer,
new di_1.Provider(api_1.ON_WEB_WORKER, { useValue: false }),
render_store_1.RenderStore,
shared_styles_host_1.DomSharedStylesHost,
testability_1.Testability,
browser_details_1.BrowserDetails,
animation_builder_1.AnimationBuilder,
common_dom_1.EventManager
]);
function initializeGenericWorkerRenderer(injector) {
export { DOCUMENT } from 'angular2/src/platform/dom/dom_tokens';
export { Title } from 'angular2/src/platform/browser/title';
export { ELEMENT_PROBE_PROVIDERS, ELEMENT_PROBE_PROVIDERS_PROD_MODE, inspectNativeElement, By } from 'angular2/platform/common_dom';
export { BrowserDomAdapter } from './browser/browser_adapter';
export { enableDebugTools, disableDebugTools } from 'angular2/src/platform/browser/tools/tools';
export { HAMMER_GESTURE_CONFIG, HammerGestureConfig } from './dom/events/hammer_gestures';
export const BROWSER_PLATFORM_MARKER = CONST_EXPR(new OpaqueToken('BrowserPlatformMarker'));
/**
* A set of providers to initialize the Angular platform in a web browser.
*
* Used automatically by `bootstrap`, or can be passed to {@link platform}.
*/
export const BROWSER_PROVIDERS = CONST_EXPR([
new Provider(BROWSER_PLATFORM_MARKER, { useValue: true }),
PLATFORM_COMMON_PROVIDERS,
new Provider(PLATFORM_INITIALIZER, { useValue: initDomAdapter, multi: true }),
]);
function _exceptionHandler() {
// !IS_DART is required because we must rethrow exceptions in JS,
// but must not rethrow exceptions in Dart
return new ExceptionHandler(DOM, !IS_DART);
}
function _document() {
return DOM.defaultDoc();
}
/**
* A set of providers to initialize an Angular application in a web browser.
*
* Used automatically by `bootstrap`, or can be passed to {@link PlatformRef.application}.
*/
export const BROWSER_APP_COMMON_PROVIDERS = CONST_EXPR([
APPLICATION_COMMON_PROVIDERS,
*/
exports.WORKER_RENDER_ROUTER = lang_1.CONST_EXPR([browser_platform_location_1.BrowserPlatformLocation]);
exports.WORKER_RENDER_APPLICATION_COMMON = lang_1.CONST_EXPR([
core_1.APPLICATION_COMMON_PROVIDERS,
exports.WORKER_RENDER_MESSAGING_PROVIDERS,
new di_1.Provider(core_1.ExceptionHandler, { useFactory: _exceptionHandler, deps: [] }),
new di_1.Provider(dom_tokens_1.DOCUMENT, { useFactory: _document, deps: [] }),
// TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread
// #5298
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: dom_events_1.DomEventsPlugin, multi: true }),
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: key_events_1.KeyEventsPlugin, multi: true }),
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: hammer_gestures_1.HammerGesturesPlugin, multi: true }),
new di_1.Provider(hammer_gestures_1.HAMMER_GESTURE_CONFIG, { useClass: hammer_gestures_1.HammerGestureConfig }),
new di_1.Provider(dom_renderer_1.DomRootRenderer, { useClass: dom_renderer_1.DomRootRenderer_ }),
new di_1.Provider(core_1.RootRenderer, { useExisting: dom_renderer_1.DomRootRenderer }),
new di_1.Provider(shared_styles_host_1.SharedStylesHost, { useExisting: shared_styles_host_1.DomSharedStylesHost }),
new di_1.Provider(compiler_1.XHR, { useClass: xhr_impl_1.XHRImpl }),
xhr_impl_2.MessageBasedXHRImpl,
new di_1.Provider(service_message_broker_1.ServiceMessageBrokerFactory, { useClass: service_message_broker_1.ServiceMessageBrokerFactory_ }),
new di_1.Provider(client_message_broker_1.ClientMessageBrokerFactory, { useClass: client_message_broker_1.ClientMessageBrokerFactory_ }),
serializer_1.Serializer,
new di_1.Provider(api_1.ON_WEB_WORKER, { useValue: false }),
render_store_1.RenderStore,
shared_styles_host_1.DomSharedStylesHost,
testability_1.Testability,
browser_details_1.BrowserDetails,
animation_builder_1.AnimationBuilder,
common_dom_1.EventManager
]);
function initializeGenericWorkerRenderer(injector) {
var bus = injector.get(message_bus_1.MessageBus);
var zone = injector.get(ng_zone_1.NgZone);
// Message based Worker classes that listen on the MessageBus
exports.WORKER_RENDER_MESSAGING_PROVIDERS = lang_1.CONST_EXPR([renderer_1.MessageBasedRenderer, xhr_impl_2.MessageBasedXHRImpl]);
exports.WORKER_RENDER_PLATFORM = lang_1.CONST_EXPR([
core_1.PLATFORM_COMMON_PROVIDERS,
new di_1.Provider(core_1.PLATFORM_INITIALIZER, { useValue: initWebWorkerRenderPlatform, multi: true })
]);
/**
* A list of {@link Provider}s. To use the router in a Worker enabled application you must
* include these providers when setting up the render thread.
*/
exports.WORKER_RENDER_ROUTER = lang_1.CONST_EXPR([browser_platform_location_1.BrowserPlatformLocation]);
exports.WORKER_RENDER_APPLICATION_COMMON = lang_1.CONST_EXPR([
core_1.APPLICATION_COMMON_PROVIDERS,
exports.WORKER_RENDER_MESSAGING_PROVIDERS,
new di_1.Provider(core_1.ExceptionHandler, { useFactory: _exceptionHandler, deps: [] }),
new di_1.Provider(dom_tokens_1.DOCUMENT, { useFactory: _document, deps: [] }),
// TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread
// #5298
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: dom_events_1.DomEventsPlugin, multi: true }),
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: key_events_1.KeyEventsPlugin, multi: true }),
new di_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: hammer_gestures_1.HammerGesturesPlugin, multi: true }),
new di_1.Provider(hammer_gestures_2.HAMMER_GESTURE_CONFIG, { useClass: hammer_gestures_2.HammerGestureConfig }),
new di_1.Provider(dom_renderer_1.DomRootRenderer, { useClass: dom_renderer_1.DomRootRenderer_ }),
new di_1.Provider(core_1.RootRenderer, { useExisting: dom_renderer_1.DomRootRenderer }),
new di_1.Provider(shared_styles_host_2.SharedStylesHost, { useExisting: shared_styles_host_1.DomSharedStylesHost }),
new di_1.Provider(compiler_1.XHR, { useClass: xhr_impl_1.XHRImpl }),
xhr_impl_2.MessageBasedXHRImpl,
new di_1.Provider(service_message_broker_1.ServiceMessageBrokerFactory, { useClass: service_message_broker_1.ServiceMessageBrokerFactory_ }),
new di_1.Provider(client_message_broker_1.ClientMessageBrokerFactory, { useClass: client_message_broker_1.ClientMessageBrokerFactory_ }),
serializer_1.Serializer,
new di_1.Provider(api_1.ON_WEB_WORKER, { useValue: false }),
render_store_1.RenderStore,
public bus: MessageBus;
/** @internal */
public init(worker: Worker, bus: MessageBus) {
this.worker = worker;
this.bus = bus;
}
}
/**
* An array of providers that should be passed into `application()` when initializing a new Worker.
*/
export const WORKER_RENDER_APPLICATION: Array = CONST_EXPR([
WORKER_RENDER_APPLICATION_COMMON,
WebWorkerInstance,
new Provider(APP_INITIALIZER,
{
useFactory: (injector: any) => () => initWebWorkerApplication(injector),
multi: true,
deps: [Injector]
}),
new Provider(MessageBus, {useFactory: initMessageBus})
]);
function initMessageBus(){
var sink = new ElectronMessageBusSink(electron.ipcRenderer);
var source = new ElectronMessageBusSource(electron.ipcRenderer);
var bus = new ElectronMessageBus(sink, source);
return bus;
}
function initWebWorkerApplication(injector: Injector): void {
*
* Used automatically by `bootstrap`, or can be passed to {@link PlatformRef.application}.
*/
exports.BROWSER_APP_COMMON_PROVIDERS = lang_1.CONST_EXPR([
core_1.APPLICATION_COMMON_PROVIDERS,
common_1.FORM_PROVIDERS,
new di_1.Provider(core_1.PLATFORM_PIPES, { useValue: common_1.COMMON_PIPES, multi: true }),
new di_1.Provider(core_1.PLATFORM_DIRECTIVES, { useValue: common_1.COMMON_DIRECTIVES, multi: true }),
new di_1.Provider(core_1.ExceptionHandler, { useFactory: _exceptionHandler, deps: [] }),
new di_1.Provider(dom_tokens_1.DOCUMENT, { useFactory: _document, deps: [] }),
new di_1.Provider(event_manager_1.EVENT_MANAGER_PLUGINS, { useClass: dom_events_1.DomEventsPlugin, multi: true }),
new di_1.Provider(event_manager_1.EVENT_MANAGER_PLUGINS, { useClass: key_events_1.KeyEventsPlugin, multi: true }),
new di_1.Provider(event_manager_1.EVENT_MANAGER_PLUGINS, { useClass: hammer_gestures_1.HammerGesturesPlugin, multi: true }),
new di_1.Provider(dom_renderer_1.DomRootRenderer, { useClass: dom_renderer_1.DomRootRenderer_ }),
new di_1.Provider(core_1.RootRenderer, { useExisting: dom_renderer_1.DomRootRenderer }),
new di_1.Provider(shared_styles_host_2.SharedStylesHost, { useExisting: shared_styles_host_1.DomSharedStylesHost }),
shared_styles_host_1.DomSharedStylesHost,
testability_1.Testability,
browser_details_1.BrowserDetails,
animation_builder_1.AnimationBuilder,
event_manager_1.EventManager,
common_dom_1.ELEMENT_PROBE_PROVIDERS
]);
function initDomAdapter() {
browser_adapter_1.BrowserDomAdapter.makeCurrent();
wtf_init_1.wtfInit();
testability_2.BrowserGetTestability.init();
}
exports.initDomAdapter = initDomAdapter;
//# sourceMappingURL=browser_common.js.map
/**
* A set of providers to initialize an Angular application in a web browser.
*
* Used automatically by `bootstrap`, or can be passed to {@link PlatformRef.application}.
*/
export const BROWSER_APP_COMMON_PROVIDERS = CONST_EXPR([
APPLICATION_COMMON_PROVIDERS,
FORM_PROVIDERS,
new Provider(PLATFORM_PIPES, { useValue: COMMON_PIPES, multi: true }),
new Provider(PLATFORM_DIRECTIVES, { useValue: COMMON_DIRECTIVES, multi: true }),
new Provider(ExceptionHandler, { useFactory: _exceptionHandler, deps: [] }),
new Provider(DOCUMENT, { useFactory: _document, deps: [] }),
new Provider(EVENT_MANAGER_PLUGINS, { useClass: DomEventsPlugin, multi: true }),
new Provider(EVENT_MANAGER_PLUGINS, { useClass: KeyEventsPlugin, multi: true }),
new Provider(EVENT_MANAGER_PLUGINS, { useClass: HammerGesturesPlugin, multi: true }),
new Provider(HAMMER_GESTURE_CONFIG, { useClass: HammerGestureConfig }),
new Provider(DomRootRenderer, { useClass: DomRootRenderer_ }),
new Provider(RootRenderer, { useExisting: DomRootRenderer }),
new Provider(SharedStylesHost, { useExisting: DomSharedStylesHost }),
DomSharedStylesHost,
Testability,
BrowserDetails,
AnimationBuilder,
EventManager,
ELEMENT_PROBE_PROVIDERS
]);
export const CACHED_TEMPLATE_PROVIDER = CONST_EXPR([new Provider(XHR, { useClass: CachedXHR })]);
export function initDomAdapter() {
BrowserDomAdapter.makeCurrent();
wtfInit();
BrowserGetTestability.init();
}