deno.land / x / replicache@v10.0.0-beta.0 / connection-loop-delegates.ts

connection-loop-delegates.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import type {ConnectionLoopDelegate} from './connection-loop';import type {OptionalLogger} from '@rocicorp/logger';import type {Replicache} from './replicache';
export class ConnectionLoopDelegateImpl implements OptionalLogger { readonly rep: Replicache; readonly invokeSend: () => Promise<boolean>; readonly logger: OptionalLogger; readonly maxConnections = 1;
constructor( rep: Replicache, invokeSend: () => Promise<boolean>, logger: OptionalLogger, ) { this.rep = rep; this.invokeSend = invokeSend; this.logger = logger; }
get maxDelayMs(): number { return this.rep.requestOptions.maxDelayMs; }
get minDelayMs(): number { return this.rep.requestOptions.minDelayMs; }
get debug(): ((...args: unknown[]) => void) | undefined { return this.logger.debug; }}
export class PullDelegate extends ConnectionLoopDelegateImpl implements ConnectionLoopDelegate{ readonly debounceDelay = 0;
get watchdogTimer(): number | null { return this.rep.pullInterval; }}
export class PushDelegate extends ConnectionLoopDelegateImpl implements ConnectionLoopDelegate{ get debounceDelay(): number { return this.rep.pushDelay; }
watchdogTimer = null;}
replicache

Version Info

Tagged at
2 years ago