mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
feat(editor): audio block (#10947)
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
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Unreachable } from '@affine/env/constant';
|
||||
|
||||
export interface RcRef<T> {
|
||||
export interface RcRef<T> extends Disposable {
|
||||
obj: T;
|
||||
release: () => void;
|
||||
}
|
||||
@@ -21,17 +21,19 @@ export class ObjectPool<Key, T> {
|
||||
if (exist) {
|
||||
exist.rc++;
|
||||
let released = false;
|
||||
const release = () => {
|
||||
// avoid double release
|
||||
if (released) {
|
||||
return;
|
||||
}
|
||||
released = true;
|
||||
exist.rc--;
|
||||
this.requestGc();
|
||||
};
|
||||
return {
|
||||
obj: exist.obj,
|
||||
release: () => {
|
||||
// avoid double release
|
||||
if (released) {
|
||||
return;
|
||||
}
|
||||
released = true;
|
||||
exist.rc--;
|
||||
this.requestGc();
|
||||
},
|
||||
release,
|
||||
[Symbol.dispose]: release,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user