UNPKG

@xmtp/proto

Version:

Protobuf client and generated classes for GRPC API

40 lines 1.05 kB
function getGlobal() { if (typeof globalThis !== "undefined") { return globalThis; } if (typeof self !== "undefined") { return self; } if (typeof window !== "undefined") { return window; } if (typeof global !== "undefined") { return global; } return undefined; } const ctx = getGlobal(); if (typeof ctx.fetch === "undefined") { // eslint-disable-next-line @typescript-eslint/no-var-requires const { fetch, Request, Response, Headers } = require("undici"); ctx.fetch = fetch; ctx.Request = Request; ctx.Response = Response; ctx.Headers = Headers; } const streamClasses = [ "TextDecoderStream", "TextEncoderStream", "TransformStream", "ReadableStream", "WritableStream", "ByteLengthQueuingStrategy", "CountQueuingStrategy", ]; for (const clsName of streamClasses) { if (typeof ctx[clsName] === "undefined") { ctx[clsName] = require("stream/web")[clsName]; } } export * from "./index"; //# sourceMappingURL=node.js.map