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
c42f4668
Commit
c42f4668
authored
1 year ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Changes to make the module load properly
parent
4435730c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!141
npm package config
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
package.json
+2
-1
2 additions, 1 deletion
package.json
src/index.ts
+12
-6
12 additions, 6 deletions
src/index.ts
webpack.config.js
+1
-0
1 addition, 0 deletions
webpack.config.js
with
15 additions
and
7 deletions
package.json
+
2
−
1
View file @
c42f4668
...
...
@@ -2,7 +2,8 @@
"name"
:
"xxdk-wasm"
,
"version"
:
"0.3.9"
,
"description"
:
"WebAssembly bindings for xxDK."
,
"module"
:
"src/index.ts"
,
"main"
:
"dist/bundle.js"
,
"module"
:
"dist/bundle.js"
,
"directories"
:
{
"test"
:
"test"
,
"src"
:
"src"
...
...
This diff is collapsed.
Click to expand it.
src/index.ts
+
12
−
6
View file @
c42f4668
...
...
@@ -4,15 +4,21 @@ declare global {
interface
Window
extends
XXDKUtils
{}
}
import
'
../wasm_exec
'
;
// @ts-ignore
import
makeWasm
from
'
../xxdk.wasm
'
;
//
import makeWasm from '../xxdk.wasm';
export
const
loadUtils
=
()
=>
new
Promise
<
XXDKUtils
>
(
async
(
res
)
=>
{
const
go
=
new
(
window
as
any
).
Go
();
const
result
=
await
makeWasm
(
go
.
importObject
);
go
.
run
(
result
.
instance
);
const
Go
=
require
(
'
../wasm_exec
'
);
const
go
=
new
Go
();
let
mod
,
inst
;
WebAssembly
.
instantiateStreaming
(
fetch
(
"
../xxdk.wasm
"
),
go
.
importObject
).
then
(
async
(
result
)
=>
{
mod
=
result
.
module
;
inst
=
result
.
instance
;
await
go
.
run
(
inst
);
inst
=
await
WebAssembly
.
instantiate
(
mod
,
go
.
importObject
);
// reset instance
}).
catch
((
err
)
=>
{
console
.
error
(
err
);
});
const
{
Base64ToUint8Array
,
...
...
This diff is collapsed.
Click to expand it.
webpack.config.js
+
1
−
0
View file @
c42f4668
...
...
@@ -11,6 +11,7 @@ module.exports = {
name
:
'
xxdk-wasm
'
,
type
:
'
umd
'
,
},
publicPath
:
''
,
},
module
:
{
rules
:
[
...
...
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