(fileMap)
| 37 | } |
| 38 | |
| 39 | export const setHashString = (fileMap) => { |
| 40 | const multiFile = Object.keys(fileMap).length > 1 |
| 41 | const code = fileMap['index.js'] |
| 42 | |
| 43 | const options = { |
| 44 | ...getHashString(), |
| 45 | code, |
| 46 | } |
| 47 | |
| 48 | // If there's no code in the editor, delete the code param |
| 49 | if (!code) { |
| 50 | delete options.code |
| 51 | } |
| 52 | |
| 53 | // If we have multiple files, use the `files` param instead of `code` |
| 54 | if (multiFile) { |
| 55 | delete options.code |
| 56 | |
| 57 | const files = Object.keys(fileMap).map(filename => [filename, fileMap[filename]]) |
| 58 | options.files = JSON.stringify(files) |
| 59 | } |
| 60 | |
| 61 | try { |
| 62 | history.replaceState({}, "", `${buildHashString(options)}`) |
| 63 | } catch (e) { |
| 64 | // Browser doesn't support pushState |
| 65 | } |
| 66 | } |
nothing calls this directly
no test coverage detected