MCPcopy Create free account
hub / github.com/apitable/apitable / init

Method init

packages/core/src/sync/room.ts:147–165  ·  view source on GitHub ↗
(firstRoomInit = false)

Source from the content-addressed store, hash-verified

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>()

Callers

nothing calls this directly

Calls 7

nextTickMethod · 0.95
watchMethod · 0.95
waitPrepareCompleteMethod · 0.80
keysMethod · 0.65
getMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected