UNPKG

2.46 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2017 TypeFox 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 WITH Classpath-exception-2.0
16// *****************************************************************************
17/* eslint-disable @typescript-eslint/no-explicit-any */
18var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22 return c > 3 && r && Object.defineProperty(target, key, r), r;
23};
24Object.defineProperty(exports, "__esModule", { value: true });
25exports.SelectionService = void 0;
26const inversify_1 = require("inversify");
27const event_1 = require("../common/event");
28/**
29 * Singleton service that is used to share the current selection globally in a Theia application.
30 * On each change of selection, subscribers are notified and receive the updated selection object.
31 */
32let SelectionService = class SelectionService {
33 constructor() {
34 this.onSelectionChangedEmitter = new event_1.Emitter();
35 this.onSelectionChanged = this.onSelectionChangedEmitter.event;
36 }
37 get selection() {
38 return this.currentSelection;
39 }
40 set selection(selection) {
41 this.currentSelection = selection;
42 this.onSelectionChangedEmitter.fire(this.currentSelection);
43 }
44};
45SelectionService = __decorate([
46 (0, inversify_1.injectable)()
47], SelectionService);
48exports.SelectionService = SelectionService;
49//# sourceMappingURL=selection-service.js.map
\No newline at end of file