| 14 | const NATIVE_CLEAR_TIMEOUT = globalThis.clearTimeout; |
| 15 | |
| 16 | export function installTimerFunctions(obj, opts) { |
| 17 | if (opts.useNativeTimers) { |
| 18 | obj.setTimeoutFn = NATIVE_SET_TIMEOUT.bind(globalThis); |
| 19 | obj.clearTimeoutFn = NATIVE_CLEAR_TIMEOUT.bind(globalThis); |
| 20 | } else { |
| 21 | obj.setTimeoutFn = globalThis.setTimeout.bind(globalThis); |
| 22 | obj.clearTimeoutFn = globalThis.clearTimeout.bind(globalThis); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | class="cm">// base64 encoded buffers are about 33% bigger (https://en.wikipedia.org/wiki/Base64) |
| 27 | const BASE64_OVERHEAD = 1.33; |