Guest User

Untitled

a guest
Jul 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. const connection = new signalR.HubConnectionBuilder()
  2. .withUrl("/notify")
  3. .build();
  4.  
  5. connection.on("notifyclient", (id,eventtype,subject,eventtime,content) => {
  6. var json = JSON.parse(content);
  7. const encodedMsg = "<strong>{" + "Notification Id: " + json.id + ",Message: " + json.subject + ",Uri: " + json.data.ItemUri + "}</strong>";
  8.  
  9. var div = document.createElement("div");
  10. var attrib = div.setAttribute("class","alert alert-success");
  11. //attrib.value = "alert alert-success";
  12.  
  13. var div_1 = document.createElement("div");
  14. var attrib_1 = div_1.setAttribute("id","messageList");
  15. //attrib_1.value = "messageList";
  16. div_1.innerHTML = encodedMsg;
  17. div.appendChild(div_1);
  18.  
  19. //li.textContent = encodedMsg;
  20. document.getElementById("tbrow").appendChild(div);
  21. });
  22.  
  23. connection.start().catch(err => console.error(err.toString()));
Add Comment
Please, Sign In to add comment