This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "scripts": { | |
| "dev": "webpack-dev-server --hot --open", | |
| "dist": "rm -rf public && NODE_ENV=production webpack --config webpack-dist.config.js --display-optimization-bailout", | |
| "jbdist": "tnpm i && NODE_ENV=production webpack --config webpack-dist.config.js" | |
| }, | |
| "dependencies": { | |
| "babel-runtime": "^6.23.0", | |
| "badjs-report": "^1.3.2", | |
| "classnames": "^2.2.5", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const delay = (ms) => { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| reject(new Error('timeout')) | |
| }, ms) | |
| }) | |
| } | |
| const fetchWithTimeout = (timeout, ...args) => { | |
| return Promise.race([fetch(...args), delay(timeout)]) // decided by the first promise resolve |