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
154ae14a
Commit
154ae14a
authored
2 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Minor bug fixes
parent
86f55658
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!60
Revert "Fail a test to be sure it works"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
wasm/e2e.go
+3
-3
3 additions, 3 deletions
wasm/e2e.go
wasm/e2eHandler.go
+1
-1
1 addition, 1 deletion
wasm/e2eHandler.go
wasm/utils.go
+5
-2
5 additions, 2 deletions
wasm/utils.go
with
9 additions
and
6 deletions
wasm/e2e.go
+
3
−
3
View file @
154ae14a
...
...
@@ -192,15 +192,15 @@ type authCallbacks struct {
func
newAuthCallbacks
(
value
js
.
Value
)
*
authCallbacks
{
a
:=
&
authCallbacks
{}
if
value
.
Get
(
"Request"
)
.
Type
()
!
=
js
.
TypeFunction
{
if
value
.
Get
(
"Request"
)
.
Type
()
=
=
js
.
TypeFunction
{
a
.
request
=
WrapCB
(
value
,
"Request"
)
}
if
value
.
Get
(
"Confirm"
)
.
Type
()
!
=
js
.
TypeFunction
{
if
value
.
Get
(
"Confirm"
)
.
Type
()
=
=
js
.
TypeFunction
{
a
.
confirm
=
WrapCB
(
value
,
"Confirm"
)
}
if
value
.
Get
(
"Reset"
)
.
Type
()
!
=
js
.
TypeFunction
{
if
value
.
Get
(
"Reset"
)
.
Type
()
=
=
js
.
TypeFunction
{
a
.
reset
=
WrapCB
(
value
,
"Reset"
)
}
...
...
This diff is collapsed.
Click to expand it.
wasm/e2eHandler.go
+
1
−
1
View file @
154ae14a
...
...
@@ -226,7 +226,7 @@ func (e *E2e) AddService(_ js.Value, args []js.Value) interface{} {
// - Throws TypeError if registering the service fails
func
(
e
*
E2e
)
RegisterListener
(
_
js
.
Value
,
args
[]
js
.
Value
)
interface
{}
{
recipientId
:=
CopyBytesToGo
(
args
[
0
])
l
:=
&
listener
{
WrapCB
(
args
[
1
],
"Hear"
),
WrapCB
(
args
[
1
],
"Name"
)}
l
:=
&
listener
{
WrapCB
(
args
[
2
],
"Hear"
),
WrapCB
(
args
[
2
],
"Name"
)}
err
:=
e
.
api
.
RegisterListener
(
recipientId
,
args
[
1
]
.
Int
(),
l
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
wasm/utils.go
+
5
−
2
View file @
154ae14a
...
...
@@ -12,6 +12,7 @@ package wasm
import
(
"encoding/json"
"fmt"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"syscall/js"
)
...
...
@@ -37,8 +38,10 @@ func CopyBytesToJS(src []byte) js.Value {
//
// Panics if m is not a function.
func
WrapCB
(
parent
js
.
Value
,
m
string
)
func
(
args
...
interface
{})
js
.
Value
{
if
parent
.
Get
(
"m"
)
.
Type
()
!=
js
.
TypeFunction
{
jww
.
FATAL
.
Panicf
(
"Function %q is not of type %s"
,
m
,
js
.
TypeFunction
)
if
parent
.
Get
(
m
)
.
Type
()
!=
js
.
TypeFunction
{
// Create the error separate from the print so stack trace is printed
err
:=
errors
.
Errorf
(
"Function %q is not of type %s"
,
m
,
js
.
TypeFunction
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
return
func
(
args
...
interface
{})
js
.
Value
{
...
...
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