overleaf/services/web/frontend/js/shared/hooks/use-abort-controller.js
Alexandre Bourdin cdaf55c7da Merge pull request #5808 from overleaf/revert-5736-ab-drop-ie11-polyfill
Revert "Remove IE11 polyfills and update browser support policy"

GitOrigin-RevId: fa44a6bfa796d191446956e94d9e533a70e59da4
2021-11-17 09:04:23 +00:00

14 lines
301 B
JavaScript

import 'abort-controller/polyfill'
import { useEffect, useState } from 'react'
export default function useAbortController() {
const [controller] = useState(() => new AbortController())
useEffect(() => {
return () => {
controller.abort()
}
}, [controller])
return controller
}