UNPKG

1.57 kBJavaScriptView Raw
1"use strict";
2/**
3 * -------------------------------------------------------------------------------------------
4 * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
5 * See License in the project root for license information.
6 * -------------------------------------------------------------------------------------------
7 */
8Object.defineProperty(exports, "__esModule", { value: true });
9exports.validatePolyFilling = void 0;
10/**
11 * @constant
12 * @function
13 * Validates availability of Promise and fetch in global context
14 * @returns The true in case the Promise and fetch available, otherwise throws error
15 */
16var validatePolyFilling = function () {
17 if (typeof Promise === "undefined" && typeof fetch === "undefined") {
18 var error = new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them.");
19 error.name = "PolyFillNotAvailable";
20 throw error;
21 }
22 else if (typeof Promise === "undefined") {
23 var error = new Error("Library cannot function without Promise. So, please provide polyfill for it.");
24 error.name = "PolyFillNotAvailable";
25 throw error;
26 }
27 else if (typeof fetch === "undefined") {
28 var error = new Error("Library cannot function without fetch. So, please provide polyfill for it.");
29 error.name = "PolyFillNotAvailable";
30 throw error;
31 }
32 return true;
33};
34exports.validatePolyFilling = validatePolyFilling;
35//# sourceMappingURL=ValidatePolyFilling.js.map
\No newline at end of file