import { IRealtimeSelect } from "../../../cshub-shared/src/api-calls" ; export class CursorList { private readonly selectObj : { [ postId ] : IRealtimeSelect [ ] ; } = { } ; public addPost ( postHash ) { this . selectObj [ postHash ] = [ ] ; } public getSelectList ( postHash ) { if ( Object . prototype . hasOwnProperty . call ( this . selectObj , postHash ) ) { return this . selectObj [ postHash ] ; } else { this . addPost ( postHash ) ; return [ ] ; } } public addPostCursor ( select ) { const newLength = this . getSelectList ( select . postHash ) . push ( select ) ; return newLength - 1 ; } }