Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container 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
xxdk-wasm
Commits
3f6909ff
Commit
3f6909ff
authored
2 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Update channels bindings for indexedDb changes
parent
d675b419
No related branches found
No related tags found
2 merge requests
!60
Revert "Fail a test to be sure it works"
,
!8
Updates to match the client fullyDecentrilizedChannels branch
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wasm/channels.go
+29
-2
29 additions, 2 deletions
wasm/channels.go
with
29 additions
and
2 deletions
wasm/channels.go
+
29
−
2
View file @
3f6909ff
...
...
@@ -10,6 +10,7 @@
package
wasm
import
(
"gitlab.com/xx_network/primitives/id"
"syscall/js"
"gitlab.com/elixxir/client/bindings"
...
...
@@ -229,6 +230,12 @@ func LoadChannelsManager(_ js.Value, args []js.Value) interface{} {
// using [Cmix.GetID].
// - args[1] - Bytes of a private identity ([channel.PrivateIdentity]) that is
// generated by [GenerateChannelIdentity] (Uint8Array).
// - args[2] - Function that takes in the same parameters as
// [indexedDb.MessageReceivedCallback]. On the Javascript side, the uuid is
// returned as an int and the channelID as a Uint8Array. The row in the
// database that was updated can be found using the UUID. The channel ID is
// provided so that the recipient can filter if they want to the processes
// the update now or not.
//
// Returns a promise:
// - Resolves to a Javascript representation of the [ChannelsManager] object.
...
...
@@ -237,9 +244,16 @@ func NewChannelsManagerWithIndexedDb(_ js.Value, args []js.Value) interface{} {
cmixID
:=
args
[
0
]
.
Int
()
privateIdentity
:=
utils
.
CopyBytesToGo
(
args
[
1
])
fn
:=
func
(
uuid
uint64
,
channelID
*
id
.
ID
)
{
args
[
2
]
.
Invoke
(
uuid
,
channelID
.
Marshal
())
}
model
:=
indexedDb
.
NewWASMEventModelBuilder
(
fn
)
promiseFn
:=
func
(
resolve
,
reject
func
(
args
...
interface
{})
js
.
Value
)
{
cm
,
err
:=
bindings
.
NewChannelsManagerGoEventModel
(
cmixID
,
privateIdentity
,
indexedDb
.
NewWasmEventM
odel
)
cmixID
,
privateIdentity
,
m
odel
)
if
err
!=
nil
{
reject
(
utils
.
JsTrace
(
err
))
}
else
{
...
...
@@ -263,6 +277,12 @@ func NewChannelsManagerWithIndexedDb(_ js.Value, args []js.Value) interface{} {
// using [Cmix.GetID].
// - args[1] - The storage tag associated with the previously created channel
// manager and retrieved with [ChannelsManager.GetStorageTag] (string).
// - args[2] - Function that takes in the same parameters as
// [indexedDb.MessageReceivedCallback]. On the Javascript side, the uuid is
// returned as an int and the channelID as a Uint8Array. The row in the
// database that was updated can be found using the UUID. The channel ID is
// provided so that the recipient can filter if they want to the processes
// the update now or not.
//
// Returns a promise:
// - Resolves to a Javascript representation of the [ChannelsManager] object.
...
...
@@ -271,9 +291,16 @@ func LoadChannelsManagerWithIndexedDb(_ js.Value, args []js.Value) interface{} {
cmixID
:=
args
[
0
]
.
Int
()
storageTag
:=
args
[
1
]
.
String
()
fn
:=
func
(
uuid
uint64
,
channelID
*
id
.
ID
)
{
args
[
2
]
.
Invoke
(
uuid
,
channelID
.
Marshal
())
}
model
:=
indexedDb
.
NewWASMEventModelBuilder
(
fn
)
promiseFn
:=
func
(
resolve
,
reject
func
(
args
...
interface
{})
js
.
Value
)
{
cm
,
err
:=
bindings
.
LoadChannelsManagerGoEventModel
(
cmixID
,
storageTag
,
indexedDb
.
NewWasmEventM
odel
)
cmixID
,
storageTag
,
m
odel
)
if
err
!=
nil
{
reject
(
utils
.
JsTrace
(
err
))
}
else
{
...
...
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