diff options
author | 2021-09-09 23:33:34 -0700 | |
---|---|---|
committer | 2021-09-09 23:33:34 -0700 | |
commit | fc907e2f81698d89502fb2ee0375e6d98a492c13 (patch) | |
tree | e775c2479b334ec901f61b5c0ccfab0102ff679e /packages/bun-framework-next/polyfills.tsx | |
parent | 8a02ad48a5eb1319c1bf3e9eb97e013924db875f (diff) | |
download | bun-jarred/fetch-experiment.tar.gz bun-jarred/fetch-experiment.tar.zst bun-jarred/fetch-experiment.zip |
currentjarred/fetch-experiment
Diffstat (limited to 'packages/bun-framework-next/polyfills.tsx')
-rw-r--r-- | packages/bun-framework-next/polyfills.tsx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/bun-framework-next/polyfills.tsx b/packages/bun-framework-next/polyfills.tsx new file mode 100644 index 000000000..b000c1f54 --- /dev/null +++ b/packages/bun-framework-next/polyfills.tsx @@ -0,0 +1,23 @@ +globalThis.global = globalThis; + +import { Buffer } from "buffer"; + +globalThis.Buffer = Buffer; + +import * as React from "react"; + +class URL { + constructor(base, source) { + this.pathname = source; + this.href = base + source; + } +} +var onlyChildPolyfill = React.Children.only; +React.Children.only = function (children) { + if (children && typeof children === "object" && children.length == 1) { + return onlyChildPolyfill(children[0]); + } + + return onlyChildPolyfill(children); +}; +globalThis.URL = URL; |