livebook/assets/js/hooks/scroll_on_update.js
Jonatan Kłosko b3b79afed4
Refactor JS hooks (#1055)
* Restructure hook files

* Simplify app.js

* Refactor hooks

* Implement password toggle with JS commands
2022-03-16 11:33:53 +01:00

19 lines
298 B
JavaScript

/**
* A hook used to scroll to the bottom of an element whenever it
* receives LV update.
*/
const ScrollOnUpdate = {
mounted() {
this.scroll();
},
updated() {
this.scroll();
},
scroll() {
this.el.scrollTop = this.el.scrollHeight;
},
};
export default ScrollOnUpdate;