Skip to content

Commit 6dcf093

Browse files
feat: add onEnabled / onDisabled callbacks (#94)
1 parent b9717d1 commit 6dcf093

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

packages/core/src/Overlay.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ export default {
8484
}
8585
},
8686
},
87+
watch: {
88+
enabled: {
89+
handler(val, oldVal) {
90+
if (val === oldVal)
91+
return
92+
if (val)
93+
this.onEnabled()
94+
else
95+
this.onDisabled()
96+
},
97+
},
98+
},
8799
mounted() {
88100
this.toggleCombo && document.body.addEventListener('keydown', this.onKeydown)
89101
this.toggleEventListener()
@@ -232,6 +244,12 @@ export default {
232244
onUpdated() {
233245
// to be replaced programmatically
234246
},
247+
onEnabled() {
248+
// to be replaced programmatically
249+
},
250+
onDisabled() {
251+
// to be replaced programmatically
252+
},
235253
},
236254
}
237255
</script>

packages/core/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export interface VueInspectorClient {
2424
enable: () => void
2525
disable: () => void
2626
toggleEnabled: () => void
27+
onEnabled: () => void
28+
onDisabled: () => void
29+
2730
openInEditor: (url: URL) => void
2831
onUpdated: () => void
2932
}

0 commit comments

Comments
 (0)