Created
March 1, 2016 16:18
-
-
Save lorenzo/aadb5541a83c964bada7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var div = document.createElement('div'); | |
var container = document.getElementById('container'); | |
div.className = "chat"; | |
container.insertBefore(div, div.firstChild); | |
var win = Elm.embed(Elm.ChatWindow, div, { | |
url: url, | |
userId: client.id, | |
userName: client.name, | |
operatorName: 'Tester' | |
}); | |
win.ports.autoScroll.subscribe(function (event) { | |
var chat = div.getElementsByClassName('chat-history')[0]; | |
chat.scrollTop = chat.scrollHeight | |
}); | |
chatWindows[client.id] = win; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment