跳到主要内容

PGliteNotificationBatcher

Defined in: packages/rxdb-adapter-pglite/src/notify/notification-batcher.ts:60

把裸 NOTIFY 聚合成 PGliteChangeEvent。

Remarks​

按 type + table + id 去重,按 type + table 分组,窗口到期或超限时一次性派发。

Constructors​

Constructor​

new PGliteNotificationBatcher(options): PGliteNotificationBatcher;

Defined in: packages/rxdb-adapter-pglite/src/notify/notification-batcher.ts:87

Parameters​

ParameterType
optionsPGliteNotificationBatcherOptions

Returns​

PGliteNotificationBatcher

Accessors​

batchTimeout​

Get Signature​

get batchTimeout(): number;

Defined in: packages/rxdb-adapter-pglite/src/notify/notification-batcher.ts:73

trailing 防抖间隔(毫秒)。

Returns​

number


hasScheduledFlush​

Get Signature​

get hasScheduledFlush(): boolean;

Defined in: packages/rxdb-adapter-pglite/src/notify/notification-batcher.ts:83

当前是否有一个还没到期的防抖定时器。

Returns​

boolean


pendingCount​

Get Signature​

get pendingCount(): number;

Defined in: packages/rxdb-adapter-pglite/src/notify/notification-batcher.ts:78

尚未分发的行事件数量。

Returns​

number

Methods​

accept()​

accept(channel, payload): void;

Defined in: packages/rxdb-adapter-pglite/src/notify/notification-batcher.ts:100

收下一条 NOTIFY。

Parameters​

ParameterTypeDescription
channelstring频道名,形如 <table>_notify
payloadstring触发器写入的 JSON 文本

Returns​

void


clear()​

clear(): void;

Defined in: packages/rxdb-adapter-pglite/src/notify/notification-batcher.ts:166

丢弃窗口内的全部事件,不派发。用于断开连接。

Returns​

void


flush()​

flush(): void;

Defined in: packages/rxdb-adapter-pglite/src/notify/notification-batcher.ts:140

立即派发窗口内的全部事件并清空窗口;已排的防抖定时器一并取消。

Returns​

void