1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export const validatePolyFilling = (): boolean => {
|
16 | if (typeof Promise === "undefined" && typeof fetch === "undefined") {
|
17 | const error = new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them.");
|
18 | error.name = "PolyFillNotAvailable";
|
19 | throw error;
|
20 | } else if (typeof Promise === "undefined") {
|
21 | const error = new Error("Library cannot function without Promise. So, please provide polyfill for it.");
|
22 | error.name = "PolyFillNotAvailable";
|
23 | throw error;
|
24 | } else if (typeof fetch === "undefined") {
|
25 | const error = new Error("Library cannot function without fetch. So, please provide polyfill for it.");
|
26 | error.name = "PolyFillNotAvailable";
|
27 | throw error;
|
28 | }
|
29 | return true;
|
30 | };
|