diff --git a/Web/Presenters/templates/Messenger/App.xml b/Web/Presenters/templates/Messenger/App.xml index 3cdfa450..67c4f3e4 100644 --- a/Web/Presenters/templates/Messenger/App.xml +++ b/Web/Presenters/templates/Messenger/App.xml @@ -17,7 +17,7 @@ {block wrap}
-
+
@@ -65,13 +65,21 @@ window.messages = ko.observableArray(initialMessages); this.messages = window.messages; this.messageContent = ko.observable(""); - this.sendMessage = model => { + + this.sendMessage = model => { if(model.messageContent() === "") return false; window.Msg.sendMessage(model.messageContent()); model.messageContent(""); - } + }; + this.loadHistory = _ => { + window.Msg._loadHistory(); + }; + this.onMessagesScroll = (model, e) => { + if(e.target.scrollTop < 21) + model.loadHistory(); + }; this.onTextareaKeyPress = (model, e) => { if(e.which === 13) { if(!e.metaKey && !e.shiftKey) {