MCPcopy
hub / github.com/tldraw/tldraw / constructor

Method constructor

packages/sync-core/src/lib/TLSyncClient.test.ts:1182–1206  ·  view source on GitHub ↗
(
					presenceSignal: Signal<IntegrationPresence | null>,
					presenceMode?: 'solo' | 'full'
				)

Source from the content-addressed store, hash-verified

1180 hasLoaded = false
1181
1182 constructor(
1183 presenceSignal: Signal<IntegrationPresence | null>,
1184 presenceMode?: 'solo' | 'full'
1185 ) {
1186 this.server = new TestServer(integrationSchema)
1187 this.socketPair = new TestSocketPair('test_presence_mode', this.server)
1188 this.socketPair.connect()
1189
1190 this.client = new TLSyncClient<R>({
1191 store: new Store({ schema: integrationSchema, props: {} }),
1192 socket: this.socketPair.clientSocket,
1193 onLoad: () => {
1194 this.hasLoaded = true
1195 },
1196 onSyncError: vi.fn((reason) => {
1197 throw new Error('onSyncError: ' + reason)
1198 }),
1199 presence: presenceSignal,
1200 presenceMode: presenceMode ? computed('', () => presenceMode) : undefined,
1201 })
1202
1203 disposables.push(() => {
1204 this.client.close()
1205 })
1206 }
1207
1208 flush() {
1209 this.server.flushDebouncingMessages()

Callers

nothing calls this directly

Calls 4

computedFunction · 0.90
connectMethod · 0.65
closeMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected