Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
clear button
Browse files Browse the repository at this point in the history
  • Loading branch information
normanrz committed Apr 10, 2018
1 parent 073231f commit 1cc1126
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 8 additions & 1 deletion demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
</head>
<body>
<div class="chat-container"></div>
<div style="text-align: center;"><button id="demo-button">Start Demo</button></div>
<div style="text-align: center;">
<button class="chat-demo-button" id="demo-button">Start Demo</button>
<button class="chat-demo-button" id="clear-button">Clear</button>
</div>
<script src="./dist/Chatroom.js"></script>
<script type="text/javascript">
window.chatroom = new window.DemoChatroom({
Expand Down Expand Up @@ -60,7 +63,11 @@
function startDemo() {
window.chatroom.demo(window.demoMessages);
}
function clearDemo() {
window.chatroom.clear();
}
document.getElementById("demo-button").addEventListener("click", startDemo, false);
document.getElementById("clear-button").addEventListener("click", clearDemo, false);
window.addEventListener("load", startDemo, false);
</script>
</body>
Expand Down
6 changes: 3 additions & 3 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
}

#demo-button {
.chat-demo-button {
border-radius: 3px;
color: #343d4e;
border: 2px solid #343d4e;
Expand All @@ -27,9 +27,9 @@
font-size: 12px;
cursor: pointer;
}
#demo-button:hover {
.chat-demo-button:hover {
background-color: rgba(52, 61, 78, 0.3);
}
#demo-button:active {
.chat-demo-button:active {
background-color: rgba(52, 61, 78, 0.8);
}
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,8 @@ window.DemoChatroom = function(options: DemoChatroomOptions) {

this.demoIsPlaying = false;
};

this.clear = () => { this.render([]); };

this.render([]);
};

0 comments on commit 1cc1126

Please sign in to comment.