/* eslint-disable @typescript-eslint/no-explicit-any */ import { Disposable } from '@gedit/utils'; const throttle = require('lodash.throttle'); // TODO 先用throttle替代 export class PlaygroundSchedule implements Disposable { protected execMap: Map void> = new Map(); push(key: any, fn: () => void): void { const execMap = this.execMap; let schedule = execMap.get(key); if (!schedule) { schedule = throttle(fn, 0) as () => void; execMap.set(key, schedule); } schedule(); } dispose(): void { this.execMap.clear(); } }