@datadog/browser-core
Advanced tools
Comparing version 5.8.0 to 5.9.0
@@ -9,3 +9,3 @@ "use strict"; | ||
var publicApi = (0, polyfills_1.assign)({ | ||
version: "5.8.0", | ||
version: "5.9.0", | ||
// This API method is intentionally not monitored, since the only thing executed is the | ||
@@ -12,0 +12,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and |
@@ -58,3 +58,3 @@ "use strict"; | ||
var retry = _b.retry, flushReason = _b.flushReason, encoding = _b.encoding; | ||
var tags = ["sdk_version:".concat("5.8.0"), "api:".concat(api)].concat(configurationTags); | ||
var tags = ["sdk_version:".concat("5.9.0"), "api:".concat(api)].concat(configurationTags); | ||
if (flushReason && (0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.COLLECT_FLUSH_REASON)) { | ||
@@ -70,3 +70,3 @@ tags.push("flush_reason:".concat(flushReason)); | ||
"dd-api-key=".concat(clientToken), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("5.8.0")), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("5.9.0")), | ||
'dd-evp-origin=browser', | ||
@@ -73,0 +73,0 @@ "dd-request-id=".concat((0, stringUtils_1.generateUUID)()), |
@@ -55,3 +55,3 @@ "use strict"; | ||
service: telemetryService, | ||
version: "5.8.0", | ||
version: "5.9.0", | ||
source: 'browser', | ||
@@ -58,0 +58,0 @@ _dd: { |
@@ -6,2 +6,3 @@ export { Configuration, InitConfiguration, validateAndBuildConfiguration, DefaultPrivacyLevel, EndpointBuilder, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration'; | ||
export { defineGlobal, makePublicApi } from './boot/init'; | ||
export { displayAlreadyInitializedError } from './boot/displayAlreadyInitializedError'; | ||
export { initReportObservable, RawReport, RawReportType } from './domain/report/reportObservable'; | ||
@@ -8,0 +9,0 @@ export { startTelemetry, Telemetry, RawTelemetryEvent, RawTelemetryConfiguration, addTelemetryDebug, addTelemetryError, startFakeTelemetry, resetTelemetry, TelemetryEvent, TelemetryErrorEvent, TelemetryDebugEvent, TelemetryConfigurationEvent, TelemetryService, isTelemetryReplicationAllowed, addTelemetryConfiguration, } from './domain/telemetry'; |
@@ -17,4 +17,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NO_ERROR_STACK_PRESENT_MESSAGE = exports.getFileFromStackTraceString = exports.toStackTraceString = exports.createHandlingStack = exports.computeRawError = exports.instrumentSetter = exports.instrumentMethod = exports.getZoneJsOriginalValue = exports.runOnReadyState = exports.sendToExtension = exports.AbstractLifeCycle = exports.createIdentityEncoder = exports.createFlushController = exports.startBatchWithReplica = exports.getEventBridge = exports.canUseEventBridge = exports.createHttpRequest = exports.SESSION_TIME_OUT_DELAY = exports.stopSessionManager = exports.startSessionManager = exports.Observable = exports.setDebugMode = exports.callMonitored = exports.monitor = exports.monitored = exports.addTelemetryConfiguration = exports.isTelemetryReplicationAllowed = exports.resetTelemetry = exports.startFakeTelemetry = exports.addTelemetryError = exports.addTelemetryDebug = exports.startTelemetry = exports.RawReportType = exports.initReportObservable = exports.makePublicApi = exports.defineGlobal = exports.computeStackTrace = exports.trackRuntimeError = exports.ExperimentalFeature = exports.getExperimentalFeatures = exports.resetExperimentalFeatures = exports.addExperimentalFeatures = exports.isExperimentalFeatureEnabled = exports.INTAKE_SITE_EU1 = exports.INTAKE_SITE_US1_FED = exports.INTAKE_SITE_US1 = exports.INTAKE_SITE_STAGING = exports.serializeConfiguration = exports.DefaultPrivacyLevel = exports.validateAndBuildConfiguration = void 0; | ||
exports.ErrorSource = exports.sanitizeUser = exports.checkUser = exports.getSyntheticsResultId = exports.getSyntheticsTestId = exports.willSyntheticsInjectRum = exports.SESSION_STORE_KEY = exports.STORAGE_POLL_DELAY = exports.readBytesFromStream = exports.CLEAR_OLD_VALUES_INTERVAL = exports.ValueHistory = exports.CUSTOMER_DATA_BYTES_LIMIT = exports.createCustomerDataTracker = exports.createCustomerDataTrackerManager = exports.removeStorageListeners = exports.storeContextManager = exports.createContextManager = exports.catchUserErrors = exports.BoundedBuffer = exports.resetConsoleObservable = exports.initConsoleObservable = exports.isPageExitReason = exports.PageExitReason = exports.createPageExitObservable = exports.initFetchObservable = exports.initXhrObservable = exports.deleteCookie = exports.setCookie = exports.getCookie = exports.areCookiesAuthorized = void 0; | ||
exports.getFileFromStackTraceString = exports.toStackTraceString = exports.createHandlingStack = exports.computeRawError = exports.instrumentSetter = exports.instrumentMethod = exports.getZoneJsOriginalValue = exports.runOnReadyState = exports.sendToExtension = exports.AbstractLifeCycle = exports.createIdentityEncoder = exports.createFlushController = exports.startBatchWithReplica = exports.getEventBridge = exports.canUseEventBridge = exports.createHttpRequest = exports.SESSION_TIME_OUT_DELAY = exports.stopSessionManager = exports.startSessionManager = exports.Observable = exports.setDebugMode = exports.callMonitored = exports.monitor = exports.monitored = exports.addTelemetryConfiguration = exports.isTelemetryReplicationAllowed = exports.resetTelemetry = exports.startFakeTelemetry = exports.addTelemetryError = exports.addTelemetryDebug = exports.startTelemetry = exports.RawReportType = exports.initReportObservable = exports.displayAlreadyInitializedError = exports.makePublicApi = exports.defineGlobal = exports.computeStackTrace = exports.trackRuntimeError = exports.ExperimentalFeature = exports.getExperimentalFeatures = exports.resetExperimentalFeatures = exports.addExperimentalFeatures = exports.isExperimentalFeatureEnabled = exports.INTAKE_SITE_EU1 = exports.INTAKE_SITE_US1_FED = exports.INTAKE_SITE_US1 = exports.INTAKE_SITE_STAGING = exports.serializeConfiguration = exports.DefaultPrivacyLevel = exports.validateAndBuildConfiguration = void 0; | ||
exports.ErrorSource = exports.sanitizeUser = exports.checkUser = exports.getSyntheticsResultId = exports.getSyntheticsTestId = exports.willSyntheticsInjectRum = exports.SESSION_STORE_KEY = exports.STORAGE_POLL_DELAY = exports.readBytesFromStream = exports.CLEAR_OLD_VALUES_INTERVAL = exports.ValueHistory = exports.CUSTOMER_DATA_BYTES_LIMIT = exports.createCustomerDataTracker = exports.createCustomerDataTrackerManager = exports.removeStorageListeners = exports.storeContextManager = exports.createContextManager = exports.catchUserErrors = exports.BoundedBuffer = exports.resetConsoleObservable = exports.initConsoleObservable = exports.isPageExitReason = exports.PageExitReason = exports.createPageExitObservable = exports.initFetchObservable = exports.initXhrObservable = exports.deleteCookie = exports.setCookie = exports.getCookie = exports.areCookiesAuthorized = exports.NO_ERROR_STACK_PRESENT_MESSAGE = void 0; | ||
var configuration_1 = require("./domain/configuration"); | ||
@@ -41,2 +41,4 @@ Object.defineProperty(exports, "validateAndBuildConfiguration", { enumerable: true, get: function () { return configuration_1.validateAndBuildConfiguration; } }); | ||
Object.defineProperty(exports, "makePublicApi", { enumerable: true, get: function () { return init_1.makePublicApi; } }); | ||
var displayAlreadyInitializedError_1 = require("./boot/displayAlreadyInitializedError"); | ||
Object.defineProperty(exports, "displayAlreadyInitializedError", { enumerable: true, get: function () { return displayAlreadyInitializedError_1.displayAlreadyInitializedError; } }); | ||
var reportObservable_1 = require("./domain/report/reportObservable"); | ||
@@ -43,0 +45,0 @@ Object.defineProperty(exports, "initReportObservable", { enumerable: true, get: function () { return reportObservable_1.initReportObservable; } }); |
@@ -1,5 +0,6 @@ | ||
export declare class BoundedBuffer { | ||
export declare class BoundedBuffer<T = void> { | ||
private buffer; | ||
add(callback: () => void): void; | ||
drain(): void; | ||
add(callback: (arg: T) => void): void; | ||
remove(callback: (arg: T) => void): void; | ||
drain(arg: T): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BoundedBuffer = void 0; | ||
var arrayUtils_1 = require("./utils/arrayUtils"); | ||
var BUFFER_LIMIT = 500; | ||
@@ -15,4 +16,7 @@ var BoundedBuffer = /** @class */ (function () { | ||
}; | ||
BoundedBuffer.prototype.drain = function () { | ||
this.buffer.forEach(function (callback) { return callback(); }); | ||
BoundedBuffer.prototype.remove = function (callback) { | ||
(0, arrayUtils_1.removeItem)(this.buffer, callback); | ||
}; | ||
BoundedBuffer.prototype.drain = function (arg) { | ||
this.buffer.forEach(function (callback) { return callback(arg); }); | ||
this.buffer.length = 0; | ||
@@ -19,0 +23,0 @@ }; |
export declare function removeDuplicates<T>(array: T[]): T[]; | ||
export declare function removeItem<T>(array: T[], item: T): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.removeDuplicates = void 0; | ||
exports.removeItem = exports.removeDuplicates = void 0; | ||
var polyfills_1 = require("./polyfills"); | ||
@@ -11,2 +11,9 @@ function removeDuplicates(array) { | ||
exports.removeDuplicates = removeDuplicates; | ||
function removeItem(array, item) { | ||
var index = array.indexOf(item); | ||
if (index >= 0) { | ||
array.splice(index, 1); | ||
} | ||
} | ||
exports.removeItem = removeItem; | ||
//# sourceMappingURL=arrayUtils.js.map |
export declare function normalizeUrl(url: string): string; | ||
export declare function isValidUrl(url: string): boolean; | ||
export declare function getOrigin(url: string): string; | ||
export declare function getPathName(url: string): string; | ||
export declare function getSearch(url: string): string; | ||
export declare function getHash(url: string): string; | ||
export declare function buildUrl(url: string, base?: string): URL | HTMLAnchorElement; | ||
export declare function getLocationOrigin(): string; | ||
/** | ||
* Fallback | ||
* On IE HTMLAnchorElement origin is not supported: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/origin | ||
* On Firefox window.location.origin is "null" for file: URIs: https://bugzilla.mozilla.org/show_bug.cgi?id=878297 | ||
*/ | ||
export declare function getLinkElementOrigin(element: Location | HTMLAnchorElement | URL): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLinkElementOrigin = exports.getLocationOrigin = exports.buildUrl = exports.getHash = exports.getSearch = exports.getPathName = exports.getOrigin = exports.isValidUrl = exports.normalizeUrl = void 0; | ||
exports.buildUrl = exports.getPathName = exports.isValidUrl = exports.normalizeUrl = void 0; | ||
var jsonStringify_1 = require("../serialisation/jsonStringify"); | ||
function normalizeUrl(url) { | ||
return buildUrl(url, getLocationOrigin()).href; | ||
return buildUrl(url, location.href).href; | ||
} | ||
@@ -18,6 +18,2 @@ exports.normalizeUrl = normalizeUrl; | ||
exports.isValidUrl = isValidUrl; | ||
function getOrigin(url) { | ||
return getLinkElementOrigin(buildUrl(url)); | ||
} | ||
exports.getOrigin = getOrigin; | ||
function getPathName(url) { | ||
@@ -28,10 +24,2 @@ var pathname = buildUrl(url).pathname; | ||
exports.getPathName = getPathName; | ||
function getSearch(url) { | ||
return buildUrl(url).search; | ||
} | ||
exports.getSearch = getSearch; | ||
function getHash(url) { | ||
return buildUrl(url).hash; | ||
} | ||
exports.getHash = getHash; | ||
function buildUrl(url, base) { | ||
@@ -77,19 +65,2 @@ var supportedURL = getSupportedUrl(); | ||
} | ||
function getLocationOrigin() { | ||
return getLinkElementOrigin(window.location); | ||
} | ||
exports.getLocationOrigin = getLocationOrigin; | ||
/** | ||
* Fallback | ||
* On IE HTMLAnchorElement origin is not supported: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/origin | ||
* On Firefox window.location.origin is "null" for file: URIs: https://bugzilla.mozilla.org/show_bug.cgi?id=878297 | ||
*/ | ||
function getLinkElementOrigin(element) { | ||
if (element.origin && element.origin !== 'null') { | ||
return element.origin; | ||
} | ||
var sanitizedHost = element.host.replace(/(:80|:443)$/, ''); | ||
return "".concat(element.protocol, "//").concat(sanitizedHost); | ||
} | ||
exports.getLinkElementOrigin = getLinkElementOrigin; | ||
//# sourceMappingURL=urlPolyfill.js.map |
@@ -5,2 +5,3 @@ "use strict"; | ||
var timer_1 = require("./timer"); | ||
var arrayUtils_1 = require("./utils/arrayUtils"); | ||
var timeUtils_1 = require("./utils/timeUtils"); | ||
@@ -32,6 +33,3 @@ var END_OF_TIMES = Infinity; | ||
remove: function () { | ||
var index = _this.entries.indexOf(entry); | ||
if (index >= 0) { | ||
_this.entries.splice(index, 1); | ||
} | ||
(0, arrayUtils_1.removeItem)(_this.entries, entry); | ||
}, | ||
@@ -38,0 +36,0 @@ close: function (endTime) { |
@@ -6,3 +6,3 @@ import { catchUserErrors } from '../tools/catchUserErrors'; | ||
var publicApi = assign({ | ||
version: "5.8.0", | ||
version: "5.9.0", | ||
// This API method is intentionally not monitored, since the only thing executed is the | ||
@@ -9,0 +9,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and |
@@ -54,3 +54,3 @@ import { timeStampNow } from '../../tools/utils/timeUtils'; | ||
var retry = _b.retry, flushReason = _b.flushReason, encoding = _b.encoding; | ||
var tags = ["sdk_version:".concat("5.8.0"), "api:".concat(api)].concat(configurationTags); | ||
var tags = ["sdk_version:".concat("5.9.0"), "api:".concat(api)].concat(configurationTags); | ||
if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.COLLECT_FLUSH_REASON)) { | ||
@@ -66,3 +66,3 @@ tags.push("flush_reason:".concat(flushReason)); | ||
"dd-api-key=".concat(clientToken), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("5.8.0")), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("5.9.0")), | ||
'dd-evp-origin=browser', | ||
@@ -69,0 +69,0 @@ "dd-request-id=".concat(generateUUID()), |
@@ -52,3 +52,3 @@ import { ConsoleApiName } from '../../tools/display'; | ||
service: telemetryService, | ||
version: "5.8.0", | ||
version: "5.9.0", | ||
source: 'browser', | ||
@@ -55,0 +55,0 @@ _dd: { |
@@ -6,2 +6,3 @@ export { Configuration, InitConfiguration, validateAndBuildConfiguration, DefaultPrivacyLevel, EndpointBuilder, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration'; | ||
export { defineGlobal, makePublicApi } from './boot/init'; | ||
export { displayAlreadyInitializedError } from './boot/displayAlreadyInitializedError'; | ||
export { initReportObservable, RawReport, RawReportType } from './domain/report/reportObservable'; | ||
@@ -8,0 +9,0 @@ export { startTelemetry, Telemetry, RawTelemetryEvent, RawTelemetryConfiguration, addTelemetryDebug, addTelemetryError, startFakeTelemetry, resetTelemetry, TelemetryEvent, TelemetryErrorEvent, TelemetryDebugEvent, TelemetryConfigurationEvent, TelemetryService, isTelemetryReplicationAllowed, addTelemetryConfiguration, } from './domain/telemetry'; |
@@ -6,2 +6,3 @@ export { validateAndBuildConfiguration, DefaultPrivacyLevel, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration'; | ||
export { defineGlobal, makePublicApi } from './boot/init'; | ||
export { displayAlreadyInitializedError } from './boot/displayAlreadyInitializedError'; | ||
export { initReportObservable, RawReportType } from './domain/report/reportObservable'; | ||
@@ -8,0 +9,0 @@ export { startTelemetry, addTelemetryDebug, addTelemetryError, startFakeTelemetry, resetTelemetry, isTelemetryReplicationAllowed, addTelemetryConfiguration, } from './domain/telemetry'; |
@@ -1,5 +0,6 @@ | ||
export declare class BoundedBuffer { | ||
export declare class BoundedBuffer<T = void> { | ||
private buffer; | ||
add(callback: () => void): void; | ||
drain(): void; | ||
add(callback: (arg: T) => void): void; | ||
remove(callback: (arg: T) => void): void; | ||
drain(arg: T): void; | ||
} |
@@ -0,1 +1,2 @@ | ||
import { removeItem } from './utils/arrayUtils'; | ||
var BUFFER_LIMIT = 500; | ||
@@ -12,4 +13,7 @@ var BoundedBuffer = /** @class */ (function () { | ||
}; | ||
BoundedBuffer.prototype.drain = function () { | ||
this.buffer.forEach(function (callback) { return callback(); }); | ||
BoundedBuffer.prototype.remove = function (callback) { | ||
removeItem(this.buffer, callback); | ||
}; | ||
BoundedBuffer.prototype.drain = function (arg) { | ||
this.buffer.forEach(function (callback) { return callback(arg); }); | ||
this.buffer.length = 0; | ||
@@ -16,0 +20,0 @@ }; |
export declare function removeDuplicates<T>(array: T[]): T[]; | ||
export declare function removeItem<T>(array: T[], item: T): void; |
@@ -7,2 +7,8 @@ import { arrayFrom } from './polyfills'; | ||
} | ||
export function removeItem(array, item) { | ||
var index = array.indexOf(item); | ||
if (index >= 0) { | ||
array.splice(index, 1); | ||
} | ||
} | ||
//# sourceMappingURL=arrayUtils.js.map |
export declare function normalizeUrl(url: string): string; | ||
export declare function isValidUrl(url: string): boolean; | ||
export declare function getOrigin(url: string): string; | ||
export declare function getPathName(url: string): string; | ||
export declare function getSearch(url: string): string; | ||
export declare function getHash(url: string): string; | ||
export declare function buildUrl(url: string, base?: string): URL | HTMLAnchorElement; | ||
export declare function getLocationOrigin(): string; | ||
/** | ||
* Fallback | ||
* On IE HTMLAnchorElement origin is not supported: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/origin | ||
* On Firefox window.location.origin is "null" for file: URIs: https://bugzilla.mozilla.org/show_bug.cgi?id=878297 | ||
*/ | ||
export declare function getLinkElementOrigin(element: Location | HTMLAnchorElement | URL): string; |
import { jsonStringify } from '../serialisation/jsonStringify'; | ||
export function normalizeUrl(url) { | ||
return buildUrl(url, getLocationOrigin()).href; | ||
return buildUrl(url, location.href).href; | ||
} | ||
@@ -13,5 +13,2 @@ export function isValidUrl(url) { | ||
} | ||
export function getOrigin(url) { | ||
return getLinkElementOrigin(buildUrl(url)); | ||
} | ||
export function getPathName(url) { | ||
@@ -21,8 +18,2 @@ var pathname = buildUrl(url).pathname; | ||
} | ||
export function getSearch(url) { | ||
return buildUrl(url).search; | ||
} | ||
export function getHash(url) { | ||
return buildUrl(url).hash; | ||
} | ||
export function buildUrl(url, base) { | ||
@@ -67,17 +58,2 @@ var supportedURL = getSupportedUrl(); | ||
} | ||
export function getLocationOrigin() { | ||
return getLinkElementOrigin(window.location); | ||
} | ||
/** | ||
* Fallback | ||
* On IE HTMLAnchorElement origin is not supported: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/origin | ||
* On Firefox window.location.origin is "null" for file: URIs: https://bugzilla.mozilla.org/show_bug.cgi?id=878297 | ||
*/ | ||
export function getLinkElementOrigin(element) { | ||
if (element.origin && element.origin !== 'null') { | ||
return element.origin; | ||
} | ||
var sanitizedHost = element.host.replace(/(:80|:443)$/, ''); | ||
return "".concat(element.protocol, "//").concat(sanitizedHost); | ||
} | ||
//# sourceMappingURL=urlPolyfill.js.map |
import { setInterval, clearInterval } from './timer'; | ||
import { removeItem } from './utils/arrayUtils'; | ||
import { addDuration, relativeNow, ONE_MINUTE } from './utils/timeUtils'; | ||
@@ -28,6 +29,3 @@ var END_OF_TIMES = Infinity; | ||
remove: function () { | ||
var index = _this.entries.indexOf(entry); | ||
if (index >= 0) { | ||
_this.entries.splice(index, 1); | ||
} | ||
removeItem(_this.entries, entry); | ||
}, | ||
@@ -34,0 +32,0 @@ close: function (endTime) { |
{ | ||
"name": "@datadog/browser-core", | ||
"version": "5.8.0", | ||
"version": "5.9.0", | ||
"license": "Apache-2.0", | ||
@@ -26,3 +26,3 @@ "main": "cjs/index.js", | ||
}, | ||
"gitHead": "450e621c48d00e8f50c97d6cc12c4ae7a7989daf" | ||
"gitHead": "465eecbc937d9ee15e2f0c03c5c574fe3e909aed" | ||
} |
@@ -23,2 +23,3 @@ export { | ||
export { defineGlobal, makePublicApi } from './boot/init' | ||
export { displayAlreadyInitializedError } from './boot/displayAlreadyInitializedError' | ||
export { initReportObservable, RawReport, RawReportType } from './domain/report/reportObservable' | ||
@@ -25,0 +26,0 @@ export { |
@@ -0,7 +1,9 @@ | ||
import { removeItem } from './utils/arrayUtils' | ||
const BUFFER_LIMIT = 500 | ||
export class BoundedBuffer { | ||
private buffer: Array<() => void> = [] | ||
export class BoundedBuffer<T = void> { | ||
private buffer: Array<(arg: T) => void> = [] | ||
add(callback: () => void) { | ||
add(callback: (arg: T) => void) { | ||
const length = this.buffer.push(callback) | ||
@@ -13,6 +15,10 @@ if (length > BUFFER_LIMIT) { | ||
drain() { | ||
this.buffer.forEach((callback) => callback()) | ||
remove(callback: (arg: T) => void) { | ||
removeItem(this.buffer, callback) | ||
} | ||
drain(arg: T) { | ||
this.buffer.forEach((callback) => callback(arg)) | ||
this.buffer.length = 0 | ||
} | ||
} |
@@ -8,1 +8,8 @@ import { arrayFrom } from './polyfills' | ||
} | ||
export function removeItem<T>(array: T[], item: T) { | ||
const index = array.indexOf(item) | ||
if (index >= 0) { | ||
array.splice(index, 1) | ||
} | ||
} |
import { jsonStringify } from '../serialisation/jsonStringify' | ||
export function normalizeUrl(url: string) { | ||
return buildUrl(url, getLocationOrigin()).href | ||
return buildUrl(url, location.href).href | ||
} | ||
@@ -15,6 +15,2 @@ | ||
export function getOrigin(url: string) { | ||
return getLinkElementOrigin(buildUrl(url)) | ||
} | ||
export function getPathName(url: string) { | ||
@@ -25,10 +21,2 @@ const pathname = buildUrl(url).pathname | ||
export function getSearch(url: string) { | ||
return buildUrl(url).search | ||
} | ||
export function getHash(url: string) { | ||
return buildUrl(url).hash | ||
} | ||
export function buildUrl(url: string, base?: string) { | ||
@@ -72,18 +60,1 @@ const supportedURL = getSupportedUrl() | ||
} | ||
export function getLocationOrigin() { | ||
return getLinkElementOrigin(window.location) | ||
} | ||
/** | ||
* Fallback | ||
* On IE HTMLAnchorElement origin is not supported: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/origin | ||
* On Firefox window.location.origin is "null" for file: URIs: https://bugzilla.mozilla.org/show_bug.cgi?id=878297 | ||
*/ | ||
export function getLinkElementOrigin(element: Location | HTMLAnchorElement | URL) { | ||
if (element.origin && element.origin !== 'null') { | ||
return element.origin | ||
} | ||
const sanitizedHost = element.host.replace(/(:80|:443)$/, '') | ||
return `${element.protocol}//${sanitizedHost}` | ||
} |
import { setInterval, clearInterval } from './timer' | ||
import type { TimeoutId } from './timer' | ||
import { removeItem } from './utils/arrayUtils' | ||
import type { Duration, RelativeTime } from './utils/timeUtils' | ||
@@ -43,6 +44,3 @@ import { addDuration, relativeNow, ONE_MINUTE } from './utils/timeUtils' | ||
remove: () => { | ||
const index = this.entries.indexOf(entry) | ||
if (index >= 0) { | ||
this.entries.splice(index, 1) | ||
} | ||
removeItem(this.entries, entry) | ||
}, | ||
@@ -49,0 +47,0 @@ close: (endTime: RelativeTime) => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
626
1042150
18331
32