INNER CODE UNIT · TypeScript

asyncFunc

mowispace/react-native-logs · src/index.ts:56

let asyncFunc = (cb: Function) => {
  if (typeof global.requestIdleCallback === "function") {
    return global.requestIdleCallback(
      () => {
        return cb();
      },
      { timeout: 100 },
    );
  }

  return setTimeout(() => {
    return cb();
  }, 0) as unknown as IdleCallbackHandle;
};

const safeStringify = (value: unknown): string => {
  if (typeof value === "string") return value;
  if (typeof value === "function")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…