UNPKG

sussudio

Version:

An unofficial VS Code Internal API

19 lines (18 loc) 916 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 "../../../base/common/event.mjs"; import { Disposable, toDisposable } from "../../../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))); } }