(firstRoomInit = false)
| 145 | } |
| 146 | |
| 147 | async init(firstRoomInit = false) { |
| 148 | // Ensure that the collaborative engine has been initialized |
| 149 | const hasCollaEngine = () => { |
| 150 | return this.collaEngineMap.has(this.roomId); |
| 151 | }; |
| 152 | do { |
| 153 | await this.nextTick(); |
| 154 | } while (!hasCollaEngine()); |
| 155 | firstRoomInit && this.sendLocalChangesetWithInit(); |
| 156 | // Initialize the collaboration engine first |
| 157 | await Promise.all( |
| 158 | Array.from(this.collaEngineMap.keys()).map((resourceId) => { |
| 159 | const collaEngine = this.collaEngineMap.get(resourceId)!; |
| 160 | return collaEngine.waitPrepareComplete(); |
| 161 | }) |
| 162 | ); |
| 163 | |
| 164 | await this.watch(); |
| 165 | } |
| 166 | |
| 167 | // When initializing, you need to send the locally cached localPendingChangeset (if any) to the server |
| 168 | @errorCapture<RoomService>() |
nothing calls this directly
no test coverage detected