mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
feat(nbstore): add nbstore worker (#9185)
This commit is contained in:
@@ -126,6 +126,16 @@ export class OpConsumer<Ops extends OpSchema> extends AutoMessageHandler {
|
||||
this.registeredOpHandlers.set(op, handler);
|
||||
}
|
||||
|
||||
registerAll(
|
||||
handlers: OpNames<Ops> extends string
|
||||
? { [K in OpNames<Ops>]: OpHandler<Ops, K> }
|
||||
: never
|
||||
) {
|
||||
for (const [op, handler] of Object.entries(handlers)) {
|
||||
this.register(op as any, handler as any);
|
||||
}
|
||||
}
|
||||
|
||||
before<Op extends OpNames<Ops>>(
|
||||
op: Op,
|
||||
handler: (...input: OpInput<Ops, Op>) => void
|
||||
|
||||
Reference in New Issue
Block a user