Skip to content

Commit 4da65e2

Browse files
committed
fix: remove unique devtools hookable
1 parent 3d667d7 commit 4da65e2

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

  • packages/app-backend-api/src

packages/app-backend-api/src/api.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,24 @@ import { Plugin } from './plugin'
2828
import { DevtoolsBackend } from './backend'
2929
import { AppRecord } from './app-record'
3030

31-
let backendOn: DevtoolsHookable
3231
const pluginOn: DevtoolsHookable[] = []
3332

3433
export class DevtoolsApi {
3534
bridge: Bridge
3635
ctx: BackendContext
3736
backend: DevtoolsBackend
37+
on: DevtoolsHookable
3838
stateEditor: StateEditor = new StateEditor()
3939

4040
constructor (backend: DevtoolsBackend, ctx: BackendContext) {
4141
this.backend = backend
4242
this.ctx = ctx
4343
this.bridge = ctx.bridge
44-
if (!backendOn) { backendOn = new DevtoolsHookable(ctx) }
45-
}
46-
47-
get on () {
48-
return backendOn
44+
this.on = new DevtoolsHookable(ctx)
4945
}
5046

5147
async callHook<T extends Hooks> (eventType: T, payload: HookPayloads[T], ctx: BackendContext = this.ctx) {
52-
payload = await backendOn.callHandlers(eventType, payload, ctx)
48+
payload = await this.on.callHandlers(eventType, payload, ctx)
5349
for (const on of pluginOn) {
5450
payload = await on.callHandlers(eventType, payload, ctx)
5551
}

0 commit comments

Comments
 (0)