()
| 168 | return "u" + fourRandomChars() + index++; |
| 169 | |
| 170 | function fourRandomChars() { |
| 171 | /* see http://stackoverflow.com/a/6248722/2519373 */ |
| 172 | return ( |
| 173 | "0000" + ((Math.random() * Math.pow(36, 4)) << 0).toString(36) |
| 174 | ).slice(-4); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | function dataAsUrl(content: string, type: string) { |