refactor ipc Main
This commit is contained in:
parent
a6351af83c
commit
a22b3c68e5
13 changed files with 139 additions and 114 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue