Skip to content

Commit 2dbda93

Browse files
committed
Svelte updates
1 parent 328cfd4 commit 2dbda93

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

svelte/svelte/src/App.svelte

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
88
onMount(async () => {
99
Talk.ready.then(() => {
10-
const me = new Talk.User(oliver);
11-
const other = new Talk.User(abby);
10+
const session = new Talk.Session({
11+
appId: appId,
12+
userId: oliver.id,
13+
});
14+
session.currentUser.createIfNotExists(oliver);
1215
13-
const session = new Talk.Session({ appId, me });
16+
const otherRef = session.user(abby.id);
17+
otherRef.createIfNotExists(abby);
1418
15-
const conversationId = Talk.oneOnOneId(me, other);
16-
const conversation = session.getOrCreateConversation(conversationId);
17-
conversation.setParticipant(me);
18-
conversation.setParticipant(other);
19+
const conversationRef = session.conversation('svelte_example_conversation');
20+
conversationRef.createIfNotExists();
21+
conversationRef.participant(otherRef).createIfNotExists();
1922
2023
const chatbox = session.createChatbox();
21-
chatbox.select(conversation);
24+
chatbox.select(conversationRef);
2225
chatbox.mount(element);
2326
});
2427
});

0 commit comments

Comments
 (0)