Chat avatar fixes (#9103)

* Ensured rejection doesn't hurt performance

* Added debounce and scroll removal

* Added debounce for keydown

* Fixed linting
This commit is contained in:
Keith Holliday
2017-09-29 16:03:43 -05:00
committed by Sabe Jones
parent dc3a02bc2e
commit 7671347d3a
4 changed files with 51 additions and 16 deletions

View File

@@ -350,6 +350,7 @@
</style>
<script>
import debounce from 'lodash/debounce';
import { mapState } from 'client/libs/store';
import { TAVERN_ID } from '../../../common/script/constants';
@@ -527,7 +528,10 @@ export default {
};
document.body.removeChild(div);
},
updateCarretPosition (eventUpdate) {
updateCarretPosition: debounce(function updateCarretPosition (eventUpdate) {
this._updateCarretPosition(eventUpdate);
}, 250),
_updateCarretPosition (eventUpdate) {
if (eventUpdate.metaKey && eventUpdate.keyCode === 13) {
this.sendMessage();
return;