Spaces:
Sleeping
Sleeping
Commit ·
98f5a11
1
Parent(s): 1dfeebd
Update static/script.js
Browse files- static/script.js +4 -4
static/script.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
myRoomId = "123"
|
| 2 |
|
| 3 |
-
createRoom(
|
| 4 |
|
| 5 |
const DELAYTIME = 500
|
| 6 |
let DATA;
|
| 7 |
|
| 8 |
-
function createRoom(roomId, url="https://jacobinathanialpeterson-chatbox2.hf.space/createRoom") {
|
| 9 |
const controller = new AbortController();
|
| 10 |
const abortSignal = controller.signal;
|
| 11 |
fetch(url, {
|
|
@@ -24,7 +24,7 @@ function createRoom(roomId, url="https://jacobinathanialpeterson-chatbox2.hf.spa
|
|
| 24 |
|
| 25 |
}
|
| 26 |
|
| 27 |
-
function postMessage(roomId, url="https://jacobinathanialpeterson-chatbox2.hf.space/postMessage") {
|
| 28 |
const controller = new AbortController();
|
| 29 |
const abortSignal = controller.signal;
|
| 30 |
fetch(url, {
|
|
@@ -42,7 +42,7 @@ function postMessage(roomId, url="https://jacobinathanialpeterson-chatbox2.hf.sp
|
|
| 42 |
.catch(error => { if (error.name === 'AbortError') { console.log('Fetch aborted:', error.message) } else { console.error('Error fetching data:', error.message) }});
|
| 43 |
}
|
| 44 |
|
| 45 |
-
function getMessages(roomId, url="https://jacobinathanialpeterson-chatbox2.hf.space/messages") {
|
| 46 |
const controller = new AbortController();
|
| 47 |
const abortSignal = controller.signal;
|
| 48 |
fetch(url, {
|
|
|
|
| 1 |
myRoomId = "123"
|
| 2 |
|
| 3 |
+
createRoom()
|
| 4 |
|
| 5 |
const DELAYTIME = 500
|
| 6 |
let DATA;
|
| 7 |
|
| 8 |
+
function createRoom(roomId=myRoomId, url="https://jacobinathanialpeterson-chatbox2.hf.space/createRoom") {
|
| 9 |
const controller = new AbortController();
|
| 10 |
const abortSignal = controller.signal;
|
| 11 |
fetch(url, {
|
|
|
|
| 24 |
|
| 25 |
}
|
| 26 |
|
| 27 |
+
function postMessage(roomId=myRoomId, url="https://jacobinathanialpeterson-chatbox2.hf.space/postMessage") {
|
| 28 |
const controller = new AbortController();
|
| 29 |
const abortSignal = controller.signal;
|
| 30 |
fetch(url, {
|
|
|
|
| 42 |
.catch(error => { if (error.name === 'AbortError') { console.log('Fetch aborted:', error.message) } else { console.error('Error fetching data:', error.message) }});
|
| 43 |
}
|
| 44 |
|
| 45 |
+
function getMessages(roomId=myRoomId, url="https://jacobinathanialpeterson-chatbox2.hf.space/messages") {
|
| 46 |
const controller = new AbortController();
|
| 47 |
const abortSignal = controller.signal;
|
| 48 |
fetch(url, {
|