UNPKG

@sussudio/platform

Version:

Internal APIs for VS Code's service injection the base services.

19 lines (18 loc) 873 B
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Emitter } from '@sussudio/base/common/event.mjs'; import { Disposable, toDisposable } from '@sussudio/base/common/lifecycle.mjs'; import { HeartbeatConstants } from '../common/terminal.mjs'; export class HeartbeatService extends Disposable { _onBeat = this._register(new Emitter()); onBeat = this._onBeat.event; constructor() { super(); const interval = setInterval(() => { this._onBeat.fire(); }, HeartbeatConstants.BeatInterval); this._register(toDisposable(() => clearInterval(interval))); } }