From 59dd9947d831a2ca7c9adbe5ec749cc93db930d0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 18 Aug 2021 12:07:22 +0200 Subject: [PATCH] check if onListeners are set --- apps/debugger/src/app/debugger-api.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/debugger/src/app/debugger-api.ts b/apps/debugger/src/app/debugger-api.ts index 8528759d14..2b5a149d16 100644 --- a/apps/debugger/src/app/debugger-api.ts +++ b/apps/debugger/src/app/debugger-api.ts @@ -119,17 +119,17 @@ export const DebuggerApiMixin = (Base) => class extends Base { debug (hash) { this.debugHash = hash - this.onDebugRequestedListener(hash) + if (this.onDebugRequestedListener) this.onDebugRequestedListener(hash) } onActivation () { - this.on('editor', 'breakpointCleared', (fileName, row) => this.onBreakpointClearedListener(fileName, row)) - this.on('editor', 'breakpointAdded', (fileName, row) => this.onBreakpointAddedListener(fileName, row)) - this.on('editor', 'contentChanged', () => this.onEditorContentChangedListener()) + this.on('editor', 'breakpointCleared', (fileName, row) => { if (this.onBreakpointClearedListener) this.onBreakpointClearedListener(fileName, row) }) + this.on('editor', 'breakpointAdded', (fileName, row) => { if (this.onBreakpointAddedListener) this.onBreakpointAddedListener(fileName, row) }) + this.on('editor', 'contentChanged', () => { if (this.onEditorContentChangedListener) this.onEditorContentChangedListener() }) } onDeactivation () { - this.onRemoveHighlightsListener() + if (this.onRemoveHighlightsListener) this.onRemoveHighlightsListener() this.off('editor', 'breakpointCleared') this.off('editor', 'breakpointAdded') this.off('editor', 'contentChanged')