Skip to content

Commit b200f90

Browse files
committed
Update: add new event to toggle & close the board manually
1 parent 5f4eada commit b200f90

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/components/BotUI.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ export default {
142142
document.addEventListener(Config.EVENT_OPEN, function () {
143143
this.botOpen()
144144
})
145+
document.addEventListener(Config.EVENT_CLOSE, function () {
146+
this.botClose()
147+
})
148+
document.addEventListener(Config.EVENT_TOGGLE, function () {
149+
this.botToggle()
150+
})
145151
},
146152
147153
beforeDestroy () {
@@ -155,6 +161,12 @@ export default {
155161
}
156162
},
157163
164+
botClose () {
165+
if (this.botActive) {
166+
this.botToggle()
167+
}
168+
},
169+
158170
botToggle () {
159171
this.botActive = !this.botActive
160172

src/config/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export default {
2-
EVENT_OPEN: 'botui-open'
2+
EVENT_OPEN: 'botui-open',
3+
EVENT_CLOSE: 'botui-close',
4+
EVENT_TOGGLE: 'botui-toggle'
35
}

0 commit comments

Comments
 (0)