MCPcopy
hub / github.com/socketio/socket.io / installTimerFunctions

Function installTimerFunctions

packages/engine.io-client/lib/util.ts:16–24  ·  packages/engine.io-client/lib/util.ts::installTimerFunctions
(obj, opts)

Source from the content-addressed store, hash-verified

14const NATIVE_CLEAR_TIMEOUT = globalThis.clearTimeout;
15
16export 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
26class="cm">// base64 encoded buffers are about 33% bigger (https://en.wikipedia.org/wiki/Base64)
27const BASE64_OVERHEAD = 1.33;

Callers 1

constructorMethod · 0.90

Calls 1

bindMethod · 0.80

Tested by

no test coverage detected