added server sent events wrapper and example

This commit is contained in:
Kevin Froman 2020-01-14 02:29:42 -06:00
parent 29421d678e
commit 828f7682b8
10 changed files with 117 additions and 37 deletions

View file

@ -129,7 +129,7 @@ function getBlocks(){
var ch = document.getElementById('feedIDInput').value
if (lastLoadedBoard !== ch){
requested = []
toggleLoadingMessage()
loadedAny = false
@ -184,7 +184,6 @@ function loadMessage(blockHash, blockList, count, channel){
}
}
setTimeout(function(){appendMessages(data, blockHash, before, channel)}, delay)
//appendMessages(data, blockHash, before)
})
}
@ -208,7 +207,7 @@ newPostForm.onsubmit = function(){
"token": webpass
}
})
.then((resp) => resp.text()) // Transform the data into json
.then((resp) => resp.text()) // Transform the data into text
.then(function(data) {
newPostForm.style.display = 'block'
if (data == 'failure due to duplicate insert'){