feat: expose isBuffering

This commit is contained in:
Adhiraj Singh
2022-11-07 09:28:46 +05:30
parent 154926ec3c
commit a4a48a1969

View File

@@ -48,6 +48,8 @@ type BaileysBufferableEventEmitter = BaileysEventEmitter & {
flush(): Promise<void> flush(): Promise<void>
/** waits for the task to complete, before releasing the buffer */ /** waits for the task to complete, before releasing the buffer */
processInBuffer(task: Promise<any>) processInBuffer(task: Promise<any>)
/** is there an ongoing buffer */
isBuffering(): boolean
} }
/** /**
@@ -139,6 +141,9 @@ export const makeEventBuffer = (logger: Logger): BaileysBufferableEventEmitter =
preBufferTask = Promise.allSettled([ preBufferTask, task ]) preBufferTask = Promise.allSettled([ preBufferTask, task ])
} }
}, },
isBuffering() {
return isBuffering
},
buffer, buffer,
flush, flush,
createBufferedFunction(work) { createBufferedFunction(work) {