UNPKG

401 BJavaScriptView Raw
1const api = require('./api');
2
3const global = typeof window !== 'undefined' ? window : self;
4
5module.exports = ({crdsUrl}) => api({
6 random: () => {
7 const array = new Uint32Array(1);
8 crypto.getRandomValues(array);
9 return Math.abs(array[0] / 0xFFFFFFFF);
10 },
11 fetch: global.fetch,
12 Headers: global.Headers,
13 encodeUtf8: s => new TextEncoder('utf-8').encode(s),
14 crdsUrl: crdsUrl,
15});