small changes and clean comments
This commit is contained in:
@@ -7879,7 +7879,7 @@ var app = (function () {
|
|||||||
return child_ctx;
|
return child_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (50:1) <Button bind:layout new_layout={back} my_class="back icon" my_title="go back {back}">
|
// (46:1) <Button bind:layout new_layout={back} my_class="back icon" my_title="go back {back}">
|
||||||
function create_default_slot_4$2(ctx) {
|
function create_default_slot_4$2(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -7899,14 +7899,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_4$2.name,
|
id: create_default_slot_4$2.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(50:1) <Button bind:layout new_layout={back} my_class=\\\"back icon\\\" my_title=\\\"go back {back}\\\">",
|
source: "(46:1) <Button bind:layout new_layout={back} my_class=\\\"back icon\\\" my_title=\\\"go back {back}\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (55:1) <Button bind:layout new_layout="room_set" my_class="room_name transparent">
|
// (51:1) <Button bind:layout new_layout="room_set" my_class="room_name transparent">
|
||||||
function create_default_slot_3$4(ctx) {
|
function create_default_slot_3$4(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -7926,14 +7926,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_3$4.name,
|
id: create_default_slot_3$4.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(55:1) <Button bind:layout new_layout=\\\"room_set\\\" my_class=\\\"room_name transparent\\\">",
|
source: "(51:1) <Button bind:layout new_layout=\\\"room_set\\\" my_class=\\\"room_name transparent\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (60:1) <Button bind:layout new_layout="close" my_class="close icon">
|
// (56:1) <Button bind:layout new_layout="close" my_class="close icon">
|
||||||
function create_default_slot_2$8(ctx) {
|
function create_default_slot_2$8(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -7953,14 +7953,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_2$8.name,
|
id: create_default_slot_2$8.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(60:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
source: "(56:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (68:4) <Msg name={msg.name}>
|
// (64:4) <Msg name={msg.name}>
|
||||||
function create_default_slot_1$8(ctx) {
|
function create_default_slot_1$8(ctx) {
|
||||||
let html_tag;
|
let html_tag;
|
||||||
let raw_value = /*msg*/ ctx[4].content + "";
|
let raw_value = /*msg*/ ctx[4].content + "";
|
||||||
@@ -7989,14 +7989,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_1$8.name,
|
id: create_default_slot_1$8.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(68:4) <Msg name={msg.name}>",
|
source: "(64:4) <Msg name={msg.name}>",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (67:3) {#each $msgs as msg}
|
// (63:3) {#each $msgs as msg}
|
||||||
function create_each_block$4(ctx) {
|
function create_each_block$4(ctx) {
|
||||||
let msg_1;
|
let msg_1;
|
||||||
let current;
|
let current;
|
||||||
@@ -8046,14 +8046,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_each_block$4.name,
|
id: create_each_block$4.name,
|
||||||
type: "each",
|
type: "each",
|
||||||
source: "(67:3) {#each $msgs as msg}",
|
source: "(63:3) {#each $msgs as msg}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (85:1) <Button my_class="send" on_click={send_msg}>
|
// (81:1) <Button my_class="send" on_click={send_msg}>
|
||||||
function create_default_slot$a(ctx) {
|
function create_default_slot$a(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -8073,7 +8073,7 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot$a.name,
|
id: create_default_slot$a.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(85:1) <Button my_class=\\\"send\\\" on_click={send_msg}>",
|
source: "(81:1) <Button my_class=\\\"send\\\" on_click={send_msg}>",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -8200,17 +8200,17 @@ var app = (function () {
|
|||||||
t4 = space();
|
t4 = space();
|
||||||
create_component(button3.$$.fragment);
|
create_component(button3.$$.fragment);
|
||||||
attr_dev(div0, "class", "msg_thread svelte-1quyp80");
|
attr_dev(div0, "class", "msg_thread svelte-1quyp80");
|
||||||
add_location(div0, file$m, 65, 2, 1218);
|
add_location(div0, file$m, 61, 2, 1104);
|
||||||
attr_dev(div1, "class", "panel panel_msg svelte-1quyp80");
|
attr_dev(div1, "class", "panel panel_msg svelte-1quyp80");
|
||||||
add_location(div1, file$m, 64, 1, 1186);
|
add_location(div1, file$m, 60, 1, 1072);
|
||||||
attr_dev(div2, "class", "text_area svelte-1quyp80");
|
attr_dev(div2, "class", "text_area svelte-1quyp80");
|
||||||
attr_dev(div2, "contenteditable", "true");
|
attr_dev(div2, "contenteditable", "true");
|
||||||
if (/*msg*/ ctx[4] === void 0) add_render_callback(() => /*div2_input_handler*/ ctx[10].call(div2));
|
if (/*msg*/ ctx[4] === void 0) add_render_callback(() => /*div2_input_handler*/ ctx[10].call(div2));
|
||||||
add_location(div2, file$m, 74, 2, 1392);
|
add_location(div2, file$m, 70, 2, 1278);
|
||||||
attr_dev(div3, "class", "panel_write svelte-1quyp80");
|
attr_dev(div3, "class", "panel_write svelte-1quyp80");
|
||||||
add_location(div3, file$m, 73, 1, 1364);
|
add_location(div3, file$m, 69, 1, 1250);
|
||||||
attr_dev(div4, "class", "grid_box svelte-1quyp80");
|
attr_dev(div4, "class", "grid_box svelte-1quyp80");
|
||||||
add_location(div4, file$m, 46, 0, 798);
|
add_location(div4, file$m, 42, 0, 684);
|
||||||
},
|
},
|
||||||
l: function claim(nodes) {
|
l: function claim(nodes) {
|
||||||
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
||||||
@@ -8396,11 +8396,7 @@ var app = (function () {
|
|||||||
let msg = "";
|
let msg = "";
|
||||||
let text_area;
|
let text_area;
|
||||||
|
|
||||||
//let msgs = [];
|
function add_local_msg(from, message) {
|
||||||
function add_msg(from, message) {
|
|
||||||
if (from === user.username) from = "me";
|
|
||||||
|
|
||||||
//msgs = [...msgs, { content: message, name: from }];
|
|
||||||
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8409,7 +8405,7 @@ var app = (function () {
|
|||||||
|
|
||||||
if (msg.length > 0) {
|
if (msg.length > 0) {
|
||||||
socket$1.emit('message', msg);
|
socket$1.emit('message', msg);
|
||||||
add_msg("me", msg);
|
add_local_msg("me", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
$$invalidate(4, msg = "");
|
$$invalidate(4, msg = "");
|
||||||
@@ -8465,13 +8461,12 @@ var app = (function () {
|
|||||||
Button: Chat_button,
|
Button: Chat_button,
|
||||||
Msg: Chat_msg,
|
Msg: Chat_msg,
|
||||||
socket: socket$1,
|
socket: socket$1,
|
||||||
user,
|
|
||||||
msgs,
|
msgs,
|
||||||
layout,
|
layout,
|
||||||
back,
|
back,
|
||||||
msg,
|
msg,
|
||||||
text_area,
|
text_area,
|
||||||
add_msg,
|
add_local_msg,
|
||||||
send_msg,
|
send_msg,
|
||||||
send_msg_if,
|
send_msg_if,
|
||||||
$msgs
|
$msgs
|
||||||
@@ -14038,12 +14033,11 @@ var app = (function () {
|
|||||||
console.log("socket.io pong");
|
console.log("socket.io pong");
|
||||||
});
|
});
|
||||||
|
|
||||||
socket$1.on('message', (from, message) => {
|
socket$1.on('message', function (from, message) {
|
||||||
|
console.log("received msg:", message, from);
|
||||||
if (from === user.username) from = "me";
|
if (from === user.username) from = "me";
|
||||||
|
|
||||||
//msgs = [...msgs, { content: message, name: from }];
|
|
||||||
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
||||||
}); //add_msg(name, message);
|
});
|
||||||
|
|
||||||
const writable_props = ['color'];
|
const writable_props = ['color'];
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -9,6 +9,7 @@
|
|||||||
import { socket, user } from './Chat_socket.svelte';
|
import { socket, user } from './Chat_socket.svelte';
|
||||||
import { msgs } from './Store_msg.js';
|
import { msgs } from './Store_msg.js';
|
||||||
|
|
||||||
|
|
||||||
// pbm: sometimes socket is still undefined here
|
// pbm: sometimes socket is still undefined here
|
||||||
socket.on('connect', function(){
|
socket.on('connect', function(){
|
||||||
console.log("socket.io connected");
|
console.log("socket.io connected");
|
||||||
@@ -47,13 +48,12 @@
|
|||||||
console.log("socket.io pong");
|
console.log("socket.io pong");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('message', function(from, message)
|
||||||
socket.on('message', (from, message) => {
|
{
|
||||||
|
console.log("received msg:", message, from);
|
||||||
if (from === user.username)
|
if (from === user.username)
|
||||||
from = "me";
|
from = "me";
|
||||||
//msgs = [...msgs, { content: message, name: from }];
|
|
||||||
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
||||||
//add_msg(name, message);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import Button from './Chat_button.svelte';
|
import Button from './Chat_button.svelte';
|
||||||
import Msg from './Chat_msg.svelte';
|
import Msg from './Chat_msg.svelte';
|
||||||
import { socket, user } from './Chat_socket.svelte';
|
import { socket } from './Chat_socket.svelte';
|
||||||
import { msgs } from './Store_msg.js';
|
import { msgs } from './Store_msg.js';
|
||||||
|
|
||||||
export let layout = "";
|
export let layout = "";
|
||||||
@@ -11,13 +11,9 @@
|
|||||||
|
|
||||||
let msg = "";
|
let msg = "";
|
||||||
let text_area;
|
let text_area;
|
||||||
//let msgs = [];
|
|
||||||
|
|
||||||
function add_msg(from, message)
|
function add_local_msg(from, message)
|
||||||
{
|
{
|
||||||
if (from === user.username)
|
|
||||||
from = "me";
|
|
||||||
//msgs = [...msgs, { content: message, name: from }];
|
|
||||||
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +22,7 @@
|
|||||||
msg = msg.trim();
|
msg = msg.trim();
|
||||||
if (msg.length > 0) {
|
if (msg.length > 0) {
|
||||||
socket.emit('message', msg);
|
socket.emit('message', msg);
|
||||||
add_msg("me", msg);
|
add_local_msg("me", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = "";
|
msg = "";
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
|
export let user = writable({});
|
||||||
|
export let socket = writable({});
|
||||||
export let msgs = writable([]);
|
export let msgs = writable([]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user