assets/src/services/editor.js
/**
   * Note: this method is currently inefficient in that any one cursor
   * movement causes all others to be redraw. However, there should be
   * few cursors in total so this is probably not going to be a concern.
   *
   * @param {Array<import('./editor_socket').UserPresence>} presences
   */
this method is currently inefficient in that any one cursor
movement causes all others to be redraw. However, there should be
few cursors in total so this is probably not going to be a concern.

@param {Array} presences
this method is currently inefficient in that any one cursor movement causes all others to be redraw . However there should be few cursors in total so this is probably not going to be a concern . @param { Array } presences
updateCursors (presences) {
    const cursorsToDelete = this.allCursors()
    presences.forEach(presence => {
      if (presence.siteId !== this.site) {
        const cursor = this.getCursorFor(presence)
        cursor.moveTo(presence.cursor)
        cursorsToDelete.delete(cursor)
      }
    })
    cursorsToDelete.forEach(cursor => {
      cursor.detach()
      this.cursorWidgets.get(cursor.userId).delete(cursor.siteId)
    })
  }
updateCursors ( presences ) { const cursorsToDelete = this . allCursors ( ) presences . forEach ( presence => { if ( presence . siteId !== this . site ) { const cursor = this . getCursorFor ( presence ) cursor . moveTo ( presence . cursor ) cursorsToDelete . delete ( cursor ) } } ) cursorsToDelete . forEach ( cursor => { cursor . detach ( ) this . cursorWidgets . get ( cursor . userId ) . delete ( cursor . siteId ) } ) }
Note: this method is currently inefficient in that any one cursor
 movement causes all others to be redraw.
Note : this method is currently inefficient in that any one cursor movement causes all others to be redraw .
// Don't draw a remote cursor for your own instance! // Remaining cursors are probably from old sessions, remove them