Path: blob/main/src/vs/platform/lifecycle/node/sharedProcessLifecycleService.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { Emitter, Event } from '../../../base/common/event.js';6import { Disposable } from '../../../base/common/lifecycle.js';7import { createDecorator } from '../../instantiation/common/instantiation.js';8import { ILogService } from '../../log/common/log.js';910export const ISharedProcessLifecycleService = createDecorator<ISharedProcessLifecycleService>('sharedProcessLifecycleService');1112export interface ISharedProcessLifecycleService {1314readonly _serviceBrand: undefined;1516/**17* An event for when the application will shutdown18*/19readonly onWillShutdown: Event<void>;20}2122export class SharedProcessLifecycleService extends Disposable implements ISharedProcessLifecycleService {2324declare readonly _serviceBrand: undefined;2526private readonly _onWillShutdown = this._register(new Emitter<void>());27readonly onWillShutdown = this._onWillShutdown.event;2829constructor(30@ILogService private readonly logService: ILogService31) {32super();33}3435fireOnWillShutdown(): void {36this.logService.trace('Lifecycle#onWillShutdown.fire()');3738this._onWillShutdown.fire();39}40}414243