Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
integration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
integration
Commits
017cde6c
Commit
017cde6c
authored
2 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Fix channel demo to work without database
parent
8eb02dec
Branches
josh/groupCreationScript
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wasm/clients/channels/channels.js
+41
-24
41 additions, 24 deletions
wasm/clients/channels/channels.js
with
41 additions
and
24 deletions
wasm/clients/channels/channels.js
+
41
−
24
View file @
017cde6c
...
...
@@ -139,21 +139,39 @@ async function joinChannel(htmlConsole, messageConsole, net, username,
* Use this when NOT using the database
*/
let
uuidCount
=
0
// The eventModel is used only without the database
let
eventModel
=
{
JoinChannel
:
function
(
channel
)
{
},
LeaveChannel
:
function
(
channelID
)
{
},
ReceiveMessage
:
function
(
channelID
,
messageID
,
senderUsername
,
text
,
timestamp
,
lease
,
roundId
,
status
)
{
messageConsole
.
overwrite
(
text
)
// htmlConsole.log(senderUsername + ": " + text)
ReceiveMessage
:
function
(
channelID
,
messageID
,
nickname
,
text
,
identity
,
timestamp
,
lease
,
roundId
,
status
)
{
htmlConsole
.
log
(
"
Identity:
"
+
dec
.
decode
(
identity
))
identity
=
jsonToObj
(
identity
)
let
msg
=
"
<strong>
"
+
identity
.
Codename
+
"
#
"
+
nickname
+
"
</strong><br />
"
+
text
+
"
<br /><br />
"
messageConsole
.
log
(
msg
)
uuidCount
++
return
uuidCount
},
ReceiveReply
:
function
(
channelID
,
messageID
,
reactionTo
,
senderUsername
,
text
,
timestamp
,
lease
,
roundId
,
status
)
{
ReceiveReply
:
function
(
channelID
,
messageID
,
reactionTo
,
senderUsername
,
text
,
identity
,
timestamp
,
lease
,
roundId
,
status
)
{
uuidCount
++
return
uuidCount
},
ReceiveReaction
:
function
(
channelID
,
messageID
,
reactionTo
,
senderUsername
,
reaction
,
timestamp
,
lease
,
roundId
,
status
)
{
ReceiveReaction
:
function
(
channelID
,
messageID
,
reactionTo
,
senderUsername
,
reaction
,
identity
,
timestamp
,
lease
,
roundId
,
status
)
{
uuidCount
++
return
uuidCount
},
UpdateSentStatus
:
function
(
messageID
,
status
)
{
UpdateSentStatus
:
function
(
uuid
,
messageID
,
timestamp
,
roundID
,
status
)
{
},
}
...
...
@@ -167,26 +185,26 @@ async function joinChannel(htmlConsole, messageConsole, net, username,
/*
* Use this when using the database
*/
/*
// Define callback that will receive message updates
let messageReceivedCallbackFunc = function (uuid, channelID) {
// This is where you query indexedDb and update the DOM
}
/*
// Define callback that will receive message updates
let messageReceivedCallbackFunc = function (uuid, channelID) {
// This is where you query indexedDb and update the DOM
}
// Create a channel manager that uses a database backend
let chanManager = await NewChannelsManagerWithIndexedDb(
net.GetID(), privateIdentity, messageReceivedCallbackFunc)
// Create a channel manager that uses a database backend
let chanManager = await NewChannelsManagerWithIndexedDb(
net.GetID(), privateIdentity, messageReceivedCallbackFunc)
// Once the channel manager is created for the first time, make sure to
// store the storage tag so that next time the page is loaded, you can load
// the already created manager
let storageTag = chanManager.GetStorageTag()
// Once the channel manager is created for the first time, make sure to
// store the storage tag so that next time the page is loaded, you can load
// the already created manager
let storageTag = chanManager.GetStorageTag()
// Once a channel manager is created, on subsequent loads,
// LoadChannelsManagerWithIndexedDb must be used to create the channel
// manager
let chanManager = await LoadChannelsManagerWithIndexedDb(
net.GetID(), storageTag, messageReceivedCallbackFunc)*/
// Once a channel manager is created, on subsequent loads,
// LoadChannelsManagerWithIndexedDb must be used to create the channel
// manager
let chanManager = await LoadChannelsManagerWithIndexedDb(
net.GetID(), storageTag, messageReceivedCallbackFunc)*/
let
chanInfo
;
...
...
@@ -203,7 +221,6 @@ async function joinChannel(htmlConsole, messageConsole, net, username,
}
nameOutput
.
value
=
chanInfo
.
Name
descriptionOutput
.
value
=
chanInfo
.
Description
idOutput
.
value
=
chanInfo
.
ChannelID
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment