Skip to content

Commit

Permalink
Initial commit for Matlab built-in libraries in wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
dherre3 committed Apr 21, 2018
0 parents commit 3878882
Show file tree
Hide file tree
Showing 12 changed files with 3,675 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Binary file added bin/get_mem.wasm
Binary file not shown.
40 changes: 40 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

const gulp = require('gulp')
const shell = require('gulp-shell')
const express = require('express')
const colors = require('colors');
const PORT = 8000;
gulp.task('compile', () => {
return gulp.src('./src/*.wat', {read: false})
.pipe(shell([
'./run_wasm.sh <%= file.path %>'
]))
})
gulp.task('compile-browser', () => {
return gulp.src('./src/*.wat', {read: false})
.pipe(shell([
'./run_wasm_browser.sh <%= file.path %>'
]))
})
gulp.task('default',()=>{
return gulp.watch('./src/*.wat',['compile'])
});
gulp.task('browser',()=>{
startServer(PORT,()=>
{
console.log("Server started at 8000!");
return gulp.watch('*.wat',['compile-browser']);
});
});

function startServer(port, callback){
const app = express()
express.static.mime.types['wasm'] = 'application/wasm'
app.use(express.static('./test/browser/'))
app.get('/result',(req, res)=>{
console.log(String(req.query.timing).bgGreen.white);
res.send("Done!");
// process.exit(0);
});
app.listen(port, callback);
}
Loading

0 comments on commit 3878882

Please sign in to comment.