Skip to content

Commit

Permalink
Add: open-delay
Browse files Browse the repository at this point in the history
  • Loading branch information
enorenio committed Jan 15, 2021
1 parent cee8bec commit 1f59cb5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ docs/.vuepress/dist
# Backups
.BACKUP
.STORAGE

# npm related
package-lock.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ List of available props to use in the component:
| `bot-typing` | Boolean | false | If `true`, the bot typing indicator will show |
| `input-disable` | Boolean | false | If `true`, message input will be disabled |
| `is-open` | Boolean | false | If `true`, the board will open from init |

| `open-delay` | Number | undefined | Delay before opening from init (in ms). Requires `is-open` to be `true` |


## Options
Expand Down
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
:messages="messageData",
:bot-typing="botTyping",
:input-disable="inputDisable",
:is-open="false",
:is-open="true",
:open-delay="2000"
@init="botStart",
@msg-send="msgSend",
)
Expand Down
16 changes: 15 additions & 1 deletion src/components/BotUI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export default {
isOpen: {
type: Boolean,
default: false
},
openDelay: {
type: Number
}
},
Expand Down Expand Up @@ -125,7 +129,11 @@ export default {
created () {
if (this.isOpen) {
this.botToggle()
if (this.openDelay) {
setTimeout(this.botOpen, this.openDelay)
} else {
this.botToggle()
}
}
EventBus.$on('select-button-option', this.selectOption)
Expand All @@ -136,6 +144,12 @@ export default {
},
methods: {
botOpen () {
if (!this.botActive) {
this.botToggle()
}
},
botToggle () {
this.botActive = !this.botActive
Expand Down

0 comments on commit 1f59cb5

Please sign in to comment.