UNPKG

4.44 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2020 Ericsson and others.
4//
5// This program and the accompanying materials are made available under the
6// terms of the Eclipse Public License v. 2.0 which is available at
7// http://www.eclipse.org/legal/epl-2.0.
8//
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License v. 2.0 are satisfied: GNU General Public License, version 2
12// with the GNU Classpath Exception which is available at
13// https://www.gnu.org/software/classpath/license.html.
14//
15// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18const inversify_1 = require("inversify");
19const uuid_1 = require("uuid");
20const contribution_provider_1 = require("../common/contribution-provider");
21const proxy_factory_1 = require("../common/messaging/proxy-factory");
22const electron_token_1 = require("../electron-common/electron-token");
23const electron_main_window_service_1 = require("../electron-common/electron-main-window-service");
24const electron_main_application_1 = require("./electron-main-application");
25const electron_main_window_service_impl_1 = require("./electron-main-window-service-impl");
26const electron_messaging_contribution_1 = require("./messaging/electron-messaging-contribution");
27const electron_messaging_service_1 = require("./messaging/electron-messaging-service");
28const electron_connection_handler_1 = require("../electron-common/messaging/electron-connection-handler");
29const electron_security_token_service_1 = require("./electron-security-token-service");
30const theia_electron_window_1 = require("./theia-electron-window");
31const electron_api_main_1 = require("./electron-api-main");
32const electronSecurityToken = { value: (0, uuid_1.v4)() };
33// eslint-disable-next-line @typescript-eslint/no-explicit-any
34global[electron_token_1.ElectronSecurityToken] = electronSecurityToken;
35exports.default = new inversify_1.ContainerModule(bind => {
36 bind(electron_main_application_1.ElectronMainApplication).toSelf().inSingletonScope();
37 bind(electron_messaging_contribution_1.ElectronMessagingContribution).toSelf().inSingletonScope();
38 bind(electron_token_1.ElectronSecurityToken).toConstantValue(electronSecurityToken);
39 bind(electron_security_token_service_1.ElectronSecurityTokenService).toSelf().inSingletonScope();
40 (0, contribution_provider_1.bindContributionProvider)(bind, electron_connection_handler_1.ElectronConnectionHandler);
41 (0, contribution_provider_1.bindContributionProvider)(bind, electron_messaging_service_1.ElectronMessagingService.Contribution);
42 (0, contribution_provider_1.bindContributionProvider)(bind, electron_main_application_1.ElectronMainApplicationContribution);
43 bind(electron_main_application_1.ElectronMainApplicationContribution).toService(electron_messaging_contribution_1.ElectronMessagingContribution);
44 bind(electron_api_main_1.TheiaMainApi).toSelf().inSingletonScope();
45 bind(electron_main_application_1.ElectronMainApplicationContribution).toService(electron_api_main_1.TheiaMainApi);
46 bind(electron_main_window_service_1.ElectronMainWindowService).to(electron_main_window_service_impl_1.ElectronMainWindowServiceImpl).inSingletonScope();
47 bind(electron_connection_handler_1.ElectronConnectionHandler).toDynamicValue(context => new proxy_factory_1.RpcConnectionHandler(electron_main_window_service_1.electronMainWindowServicePath, () => context.container.get(electron_main_window_service_1.ElectronMainWindowService))).inSingletonScope();
48 bind(electron_main_application_1.ElectronMainProcessArgv).toSelf().inSingletonScope();
49 bind(theia_electron_window_1.TheiaElectronWindow).toSelf();
50 bind(theia_electron_window_1.TheiaElectronWindowFactory).toFactory(({ container }) => (options, config) => {
51 const child = container.createChild();
52 child.bind(theia_electron_window_1.TheiaBrowserWindowOptions).toConstantValue(options);
53 child.bind(theia_electron_window_1.WindowApplicationConfig).toConstantValue(config);
54 return child.get(theia_electron_window_1.TheiaElectronWindow);
55 });
56});
57//# sourceMappingURL=electron-main-application-module.js.map
\No newline at end of file