Skip to content

Commit ca4cdbd

Browse files
committed
🐛 fix polyfill.js/.mjs to work properly
1 parent ec16621 commit ca4cdbd

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

polyfill.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
/*globals require, self, window */
22
"use strict"
33

4-
const ac = require(".")
4+
const ac = require("./dist/abort-controller")
55

6-
/*eslint-disable no-shadow, @mysticatea/prettier */
7-
const global =
8-
typeof window !== "undefined" ? window :
6+
/*eslint-disable @mysticatea/prettier */
7+
const g =
98
typeof self !== "undefined" ? self :
9+
typeof window !== "undefined" ? window :
10+
typeof global !== "undefined" ? global :
1011
/* otherwise */ undefined
11-
/*eslint-enable no-shadow, @mysticatea/prettier */
12+
/*eslint-enable @mysticatea/prettier */
1213

13-
if (global) {
14-
if (typeof global.AbortController === "undefined") {
15-
global.AbortController = ac.AbortController
14+
if (g) {
15+
if (typeof g.AbortController === "undefined") {
16+
g.AbortController = ac.AbortController
1617
}
17-
if (typeof global.AbortSignal === "undefined") {
18-
global.AbortSignal = ac.AbortSignal
18+
if (typeof g.AbortSignal === "undefined") {
19+
g.AbortSignal = ac.AbortSignal
1920
}
2021
}

polyfill.mjs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
/*globals self, window */
2-
import * as ac from "."
2+
import * as ac from "./dist/abort-controller"
33

4-
/*eslint-disable no-shadow, @mysticatea/prettier */
5-
const global =
6-
typeof window !== "undefined" ? window :
4+
/*eslint-disable @mysticatea/prettier */
5+
const g =
76
typeof self !== "undefined" ? self :
7+
typeof window !== "undefined" ? window :
8+
typeof global !== "undefined" ? global :
89
/* otherwise */ undefined
9-
/*eslint-enable no-shadow, @mysticatea/prettier */
10+
/*eslint-enable @mysticatea/prettier */
1011

11-
if (global) {
12-
if (typeof global.AbortController === "undefined") {
13-
global.AbortController = ac.AbortController
12+
if (g) {
13+
if (typeof g.AbortController === "undefined") {
14+
g.AbortController = ac.AbortController
1415
}
15-
if (typeof global.AbortSignal === "undefined") {
16-
global.AbortSignal = ac.AbortSignal
16+
if (typeof g.AbortSignal === "undefined") {
17+
g.AbortSignal = ac.AbortSignal
1718
}
1819
}

0 commit comments

Comments
 (0)