/**
 * This file is part of the vscode-helpers distribution.
 * Copyright (c) Marcel Joachim Kloubert.
 *
 * vscode-helpers is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, version 3.
 *
 * vscode-helpers is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */ import * as Events from 'events' ; import * as vscode from 'vscode' ; /**
 * Stores the global event emitter.
 */ export const EVENTS = new Events . EventEmitter ( ) ; /**
 * Disposes the event emitter, stored in 'EVENTS'.
 */ export const EVENT_DISPOSER = { inheritdoc dispose : ( ) => { EVENTS . removeAllListeners ( ) ; } } ; param { NodeJS . EventEmitter } obj param { string | symbol } ev return { boolean } export function tryRemoveAllListeners ( obj , ev ? ) { try { if ( obj && obj . removeAllListeners ) { obj . removeAllListeners ( ev ) ; } return true ; } catch { return false ; } } param { NodeJS . EventEmitter } obj param { string | symbol } ev param { Function } listener return { boolean } export function tryRemoveListener ( obj , ev , listener ) { try { if ( obj && obj . removeListener ) { obj . removeListener ( ev , listener ) ; } return true ; } catch { return false ; } }