This file contains 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
export const webFileToResumableDescriptor = (file, uploadId) => async function(chunkSize) { | |
uploadId = uploadId || file.name; | |
return { | |
bytesCount: file.size, | |
uploadId: uploadId, | |
filename: file.name, | |
generator: async function*() { | |
let chunkIndex = 0; | |
// While starting byte is less than the file size, continue. |
This file contains 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
if(module.hot) { | |
module.hot.accept(() => { | |
window.store.replaceReducer(reducer) | |
window.cancelAnimationFrame(window.raf); | |
window.raf = window.requestAnimationFrame(step) | |
}); | |
} | |
function step(dt) { | |
graphics(window.ctx, window.store.getState(), dt); |
This file contains 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
//Mutable version | |
const flatten = (arr) => | |
arr.reduce((c, v) => | |
(Array.isArray(v)) | |
? c.concat(flatten(v)) | |
: [...c, v] | |
, []); | |
//or more effecient, in place | |
const flatten_in = (arr) => |