mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
01439641ca
React IDE page: working editor GitOrigin-RevId: 3ba8cb787a6f7f8435686d8962adb7444d09acb5
16 lines
480 B
TypeScript
16 lines
480 B
TypeScript
import { debugConsole } from '@/utils/debugging'
|
|
|
|
type EditorEvent = { type: string; meta: unknown; date: Date }
|
|
|
|
// Record events and then do nothing with them.
|
|
export class EventLog {
|
|
private recentEvents: EditorEvent[] = []
|
|
|
|
pushEvent = (type: string, meta: unknown = {}) => {
|
|
debugConsole.log('event', type, meta)
|
|
this.recentEvents.push({ type, meta, date: new Date() })
|
|
if (this.recentEvents.length > 100) {
|
|
return this.recentEvents.shift()
|
|
}
|
|
}
|
|
}
|