refactor ipc Main

This commit is contained in:
riqo 2021-06-19 11:21:47 -05:00
commit a22b3c68e5
13 changed files with 139 additions and 114 deletions

View file

@ -6,12 +6,12 @@
let buffer: ArrayBuffer[] = [];
// place audio data in buffer
export function collect (chunk: ArrayBuffer) {
buffer.push(chunk);
export const collect: IpcListenerCallback<ArrayBuffer> = (chunk) => {
if (chunk) buffer.push(chunk);
}
// return audio and clear buffer
export function flush () {
export const flush = async () => {
const bufferCopy = buffer;
buffer = [];
return bufferCopy;