1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 09:24:35 +00:00

fix(*): use fetch polyfill for Firefox versions older than 60

This commit is contained in:
Krishna Acondy
2020-08-13 21:46:08 +01:00
parent 870cc0055b
commit 59674744be
2 changed files with 9 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import * as e6p from "es6-promise";
(e6p as any).polyfill();
if (isIEorEdgeOrFirefox60()) {
if (isIEorEdgeOrOldFirefox()) {
window.fetch = undefined as any; // ensure the polyfill runs
}
// tslint:disable-next-line
@@ -31,7 +31,7 @@ import {
import { SASViyaApiClient } from "./SASViyaApiClient";
import { SAS9ApiClient } from "./SAS9ApiClient";
import { FileUploader } from "./FileUploader";
import { isIEorEdgeOrFirefox60 } from "./utils/isIeOrEdge";
import { isIEorEdgeOrOldFirefox } from "./utils/isIeOrEdge";
const defaultConfig: SASjsConfig = {
serverUrl: "",

View File

@@ -1,8 +1,12 @@
export function isIEorEdgeOrFirefox60() {
export function isIEorEdgeOrOldFirefox() {
const ua = window.navigator.userAgent;
if (ua.indexOf("Firefox/60") > 0) {
return true;
if (ua.indexOf("Firefox") > 0) {
const version = parseInt(
ua.substring(ua.lastIndexOf("Firefox/") + 8, ua.length),
10
);
return version <= 60;
}
const msie = ua.indexOf("MSIE ");