Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wasm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
wasm-watermarker
Commits
8b68ba49
Commit
8b68ba49
authored
May 27, 2019
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a simple wasm driver
parent
025d42c5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
index.ts
server/src/index.ts
+1
-1
index.html
server/static/index.html
+10
-1
No files found.
server/src/index.ts
View file @
8b68ba49
...
@@ -12,7 +12,7 @@ const server = app.listen(port, () => {
...
@@ -12,7 +12,7 @@ const server = app.listen(port, () => {
app
.
get
(
"/wasm/add.wasm"
,
(
req
:
express
.
Request
,
res
:
express
.
Response
)
=>
{
app
.
get
(
"/wasm/add.wasm"
,
(
req
:
express
.
Request
,
res
:
express
.
Response
)
=>
{
const
binary
=
fs
.
readFileSync
(
`
${
__dirname
}
/../wasm/add.wasm`
);
const
binary
=
fs
.
readFileSync
(
`
${
__dirname
}
/../wasm/add.wasm`
);
res
.
writeHead
(
200
,
{
contentType
:
"application/wasm"
});
res
.
writeHead
(
200
,
{
"Content-Type"
:
"application/wasm"
});
res
.
end
(
binary
);
res
.
end
(
binary
);
});
});
...
...
server/static/index.html
View file @
8b68ba49
...
@@ -8,7 +8,16 @@
...
@@ -8,7 +8,16 @@
<body>
<body>
<h1>
Watermark Server
</h1>
<h1>
Watermark Server
</h1>
<script>
<script>
console
.
log
(
"Hello, world!"
);
(
async
()
=>
{
const
wasm
=
await
WebAssembly
.
instantiateStreaming
(
fetch
(
"wasm/add.wasm"
)
);
const
{
add2
,
add3
}
=
wasm
.
instance
.
exports
;
console
.
log
(
add2
(
42
,
88
));
console
.
log
(
add3
(
42
,
88
,
64
));
})();
</script>
</script>
</body>
</body>
</html>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment