I have a function scrolltobottom()that runs after each function is executed.
How can I reorganize the code so that I do not need to type scrolltobottom()everywhere?
Preferably without using jQuery.
async function initBot () {
let botui = BotUI('homepage-bot', {
vue: Vue
})
let scrolltobottom = () => {
let ele = document.getElementById('botui')
document.body.scrollTop = ele.clientHeight
}
await botui.message.bot({"Hello"})
await scrolltobottom()
await botui.message.bot({"Do you like apple or orange?"})
await scrolltobottom()
await botui.message.button({"Orange", "Apple"})
await scrolltobottom()
}
source
share