Minimal example making webpack and wasm/Emscripten work together.
Build instructions:
- Clone this gist
npm installnpm start- Open
http://localhost:8080 - Look at console
| # Docker files | |
| .dockerignore | |
| Dockerfile | |
| # Git files | |
| .git | |
| # Node files | |
| node_modules |
Minimal example making webpack and wasm/Emscripten work together.
Build instructions:
npm installnpm starthttp://localhost:8080The proposal you’re about to read is not just a proposal. We have a working implementation of almost everything we discussed here. We encourage you to checkout and build our branch: our fork, with the relevant branch selected. Building and using the implementation will give you a better understanding of what using it as a developer is like.
Our implementation ended up differing from the proposal on some minor points. As our last action item before making a PR, we’re writing documentation on what we did. While I loathe pointing to tests in lieu of documentation, they will be helpful until we complete writing docs: the unit tests.
This repo also contains a bundled version of npm that has a new command, asset. You can read the documentation for and goals of that comma
| // mock file | |
| function MockFile() { }; | |
| MockFile.prototype.create = function (name, size, mimeType) { | |
| name = name || "mock.txt"; | |
| size = size || 1024; | |
| mimeType = mimeType || 'plain/txt'; | |
| function range(count) { | |
| var output = ""; |
| const wait = ( | |
| time, | |
| cancel = Promise.reject() | |
| ) => new Promise((resolve, reject) => { | |
| const timer = setTimeout(resolve, time); | |
| const noop = () => {}; | |
| cancel.then(() => { | |
| clearTimeout(timer); | |
| reject(new Error('Cancelled')); |
| /* | |
| Template literals for-loop example | |
| Using `Array(5).join(0).split(0)`, we create an empty array | |
| with 5 items which we can iterate through using `.map()` | |
| */ | |
| var element = document.createElement('div') | |
| element.innerHTML = ` | |
| <h1>This element is looping</h1> | |
| ${Array(5).join(0).split(0).map((item, i) => ` |
| let arr1 = [3, 5, 2, 2, 5, 5]; | |
| let arr2 = [2, 1, 66, 5]; | |
| let unique = [...new Set([...arr1,...arr2])]; | |
| console.log(unique); | |
| // [ 3, 5, 2, 1, 66 ] |
| // This problem was inspired by this original tweet by Max Howell: | |
| // Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off. | |
| // So, let's invert a binary tree in Javascript | |
| // Original Tree | |
| // 4 | |
| // / \ | |
| // 2 7 | |
| // / \ / \ |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm