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

Commit

Permalink
make demoMessages accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
normanrz committed Apr 10, 2018
1 parent 894e4c1 commit 073231f
Showing 1 changed file with 40 additions and 33 deletions.
73 changes: 40 additions & 33 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,49 @@
title: "Chat with a bot",
container: document.querySelector(".chat-container"),
});
function startDemo() {
window.chatroom.demo([
{
message: { type: "text", text: "Hello how can I help you?" },
username: "bot",
},
{
message: { type: "text", text: "I need glue" },
username: "user",
},
{
message: {
type: "text",
text: "We have many sorts of adhesives. Let me help you find the right one.",
},
username: "bot",

window.demoMessages = [
{
message: { type: "text", text: "Hello how can I help you?" },
username: "bot"
},
{
message: { type: "text", text: "I need glue" },
username: "user"
},
{
message: {
type: "text",
text:
"We have many sorts of adhesives. Let me help you find the right one."
},
{
message: {
type: "text",
text: "Are you bonding magnets?",
},
username: "bot",
username: "bot"
},
{
message: {
type: "text",
text: "Are you bonding magnets?"
},
{
message: {
type: "button",
buttons: [{ title: "Yes", payload: "Yes" }, { title: "No", payload: "No" }],
},
username: "bot",
username: "bot"
},
{
message: {
type: "button",
buttons: [
{ title: "Yes", payload: "Yes" },
{ title: "No", payload: "No" }
]
},
{
message: { type: "text", text: "No" },
username: "user",
},
]);
username: "bot"
},
{
message: { type: "text", text: "No" },
username: "user"
}
];

function startDemo() {
window.chatroom.demo(window.demoMessages);
}
document.getElementById("demo-button").addEventListener("click", startDemo, false);
window.addEventListener("load", startDemo, false);
Expand Down

0 comments on commit 073231f

Please sign in to comment.