mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-08 20:57:08 +08:00
fad49bb070
AudioMedia entity for loading & controlling a single audio media AudioMediaManagerService: Global audio state synchronization across tabs AudioAttachmentService + AudioAttachmentBlock for manipulating AttachmentBlock in affine - e.g., filling transcription (using mock endpoint for now) Added AudioBlock + AudioPlayer for rendering audio block in affine (new transcription block whose renderer is provided in affine) fix AF-2292 fix AF-2337
35 lines
773 B
TypeScript
35 lines
773 B
TypeScript
import { AsyncCall } from 'async-call-rpc';
|
|
|
|
import type { HelperToMain, MainToHelper } from '../shared/type';
|
|
import { exposed } from './provide';
|
|
|
|
const helperToMainServer: HelperToMain = {
|
|
getMeta: () => {
|
|
if (!exposed) {
|
|
throw new Error('Helper is not initialized correctly');
|
|
}
|
|
return exposed;
|
|
},
|
|
};
|
|
|
|
export const mainRPC = AsyncCall<MainToHelper>(helperToMainServer, {
|
|
strict: {
|
|
unknownMessage: false,
|
|
},
|
|
channel: {
|
|
on(listener) {
|
|
const f = (e: Electron.MessageEvent) => {
|
|
listener(e.data);
|
|
};
|
|
process.parentPort.on('message', f);
|
|
return () => {
|
|
process.parentPort.off('message', f);
|
|
};
|
|
},
|
|
send(data) {
|
|
process.parentPort.postMessage(data);
|
|
},
|
|
},
|
|
log: false,
|
|
});
|