Minimal example making webpack and wasm/Emscripten work together.
Build instructions:
- Clone this gist
npm installnpm start- Open
http://localhost:8080 - Look at console
Minimal example making webpack and wasm/Emscripten work together.
Build instructions:
npm installnpm starthttp://localhost:8080| // A common redux pattern when dealing with async functions is to use thunk. | |
| // This usually means your action returns a new function instead of an action object, | |
| // and the thunk middleware will make it all work. Example: | |
| const asyncAction = () => dispatch => setTimeout(() => dispatch(someOtherAction()), 10000); | |
| // Now: maybe that async stuff going on is calling some API which you don't want to overload | |
| // with request, and that's what debounce is for. | |
| // This is an example of a debounced function which will only be calleable once every second. | |
| import { debounce } from 'lodash'; | |
| const debouncedFn = debounce(() => callApi(), 1000, { leading: true, trailing: false }); |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.