@datadog/browser-rum-core
Advanced tools
Comparing version 3.6.10 to 3.6.11
@@ -6,4 +6,4 @@ "use strict"; | ||
buildMode: 'release', | ||
sdkVersion: '3.6.10', | ||
sdkVersion: '3.6.11', | ||
}; | ||
//# sourceMappingURL=buildEnv.js.map |
@@ -31,21 +31,22 @@ "use strict"; | ||
function trackHistory(onHistoryChange) { | ||
// eslint-disable-next-line @typescript-eslint/unbound-method | ||
var originalPushState = history.pushState; | ||
history.pushState = browser_core_1.monitor(function () { | ||
originalPushState.apply(this, arguments); | ||
onHistoryChange(); | ||
}); | ||
// eslint-disable-next-line @typescript-eslint/unbound-method | ||
var originalReplaceState = history.replaceState; | ||
history.replaceState = browser_core_1.monitor(function () { | ||
originalReplaceState.apply(this, arguments); | ||
onHistoryChange(); | ||
}); | ||
var stopInstrumentingPushState = browser_core_1.instrumentMethod(history, 'pushState', function (original) { | ||
return function () { | ||
original.apply(this, arguments); | ||
browser_core_1.callMonitored(onHistoryChange); | ||
}; | ||
}).stop; | ||
var stopInstrumentingReplaceState = browser_core_1.instrumentMethod(history, 'replaceState', function (original) { | ||
return function () { | ||
original.apply(this, arguments); | ||
browser_core_1.callMonitored(onHistoryChange); | ||
}; | ||
}).stop; | ||
var removeListener = browser_core_1.addEventListener(window, "popstate" /* POP_STATE */, onHistoryChange).stop; | ||
var stop = function () { | ||
removeListener(); | ||
history.pushState = originalPushState; | ||
history.replaceState = originalReplaceState; | ||
return { | ||
stop: function () { | ||
stopInstrumentingPushState(); | ||
stopInstrumentingReplaceState(); | ||
removeListener(); | ||
}, | ||
}; | ||
return { stop: stop }; | ||
} | ||
@@ -52,0 +53,0 @@ function trackHash(onHashChange) { |
export var buildEnv = { | ||
buildMode: 'release', | ||
sdkVersion: '3.6.10', | ||
sdkVersion: '3.6.11', | ||
}; | ||
//# sourceMappingURL=buildEnv.js.map |
import { __assign } from "tslib"; | ||
import { monitor, addEventListener, Observable } from '@datadog/browser-core'; | ||
import { addEventListener, Observable, callMonitored, instrumentMethod } from '@datadog/browser-core'; | ||
export function createLocationChangeObservable(location) { | ||
@@ -27,21 +27,22 @@ var currentLocation = __assign({}, location); | ||
function trackHistory(onHistoryChange) { | ||
// eslint-disable-next-line @typescript-eslint/unbound-method | ||
var originalPushState = history.pushState; | ||
history.pushState = monitor(function () { | ||
originalPushState.apply(this, arguments); | ||
onHistoryChange(); | ||
}); | ||
// eslint-disable-next-line @typescript-eslint/unbound-method | ||
var originalReplaceState = history.replaceState; | ||
history.replaceState = monitor(function () { | ||
originalReplaceState.apply(this, arguments); | ||
onHistoryChange(); | ||
}); | ||
var stopInstrumentingPushState = instrumentMethod(history, 'pushState', function (original) { | ||
return function () { | ||
original.apply(this, arguments); | ||
callMonitored(onHistoryChange); | ||
}; | ||
}).stop; | ||
var stopInstrumentingReplaceState = instrumentMethod(history, 'replaceState', function (original) { | ||
return function () { | ||
original.apply(this, arguments); | ||
callMonitored(onHistoryChange); | ||
}; | ||
}).stop; | ||
var removeListener = addEventListener(window, "popstate" /* POP_STATE */, onHistoryChange).stop; | ||
var stop = function () { | ||
removeListener(); | ||
history.pushState = originalPushState; | ||
history.replaceState = originalReplaceState; | ||
return { | ||
stop: function () { | ||
stopInstrumentingPushState(); | ||
stopInstrumentingReplaceState(); | ||
removeListener(); | ||
}, | ||
}; | ||
return { stop: stop }; | ||
} | ||
@@ -48,0 +49,0 @@ function trackHash(onHashChange) { |
{ | ||
"name": "@datadog/browser-rum-core", | ||
"version": "3.6.10", | ||
"version": "3.6.11", | ||
"license": "Apache-2.0", | ||
@@ -15,3 +15,3 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@datadog/browser-core": "3.6.10", | ||
"@datadog/browser-core": "3.6.11", | ||
"tslib": "^1.10.0" | ||
@@ -27,3 +27,3 @@ }, | ||
}, | ||
"gitHead": "00bea02238105cd857ba79922976e57190f54e53" | ||
"gitHead": "a410b4ca69535550c35bf066eca22a997f02277e" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { monitor, addEventListener, DOM_EVENT, Observable } from '@datadog/browser-core' | ||
import { addEventListener, DOM_EVENT, Observable, callMonitored, instrumentMethod } from '@datadog/browser-core' | ||
@@ -35,21 +35,31 @@ export interface LocationChange { | ||
function trackHistory(onHistoryChange: () => void) { | ||
// eslint-disable-next-line @typescript-eslint/unbound-method | ||
const originalPushState = history.pushState | ||
history.pushState = monitor(function (this: History['pushState']) { | ||
originalPushState.apply(this, arguments as any) | ||
onHistoryChange() | ||
}) | ||
// eslint-disable-next-line @typescript-eslint/unbound-method | ||
const originalReplaceState = history.replaceState | ||
history.replaceState = monitor(function (this: History['replaceState']) { | ||
originalReplaceState.apply(this, arguments as any) | ||
onHistoryChange() | ||
}) | ||
const { stop: stopInstrumentingPushState } = instrumentMethod( | ||
history, | ||
'pushState', | ||
(original) => | ||
function () { | ||
original.apply(this, arguments as any) | ||
callMonitored(onHistoryChange) | ||
} | ||
) | ||
const { stop: stopInstrumentingReplaceState } = instrumentMethod( | ||
history, | ||
'replaceState', | ||
(original) => | ||
function () { | ||
original.apply(this, arguments as any) | ||
callMonitored(onHistoryChange) | ||
} | ||
) | ||
const { stop: removeListener } = addEventListener(window, DOM_EVENT.POP_STATE, onHistoryChange) | ||
const stop = () => { | ||
removeListener() | ||
history.pushState = originalPushState | ||
history.replaceState = originalReplaceState | ||
return { | ||
stop: () => { | ||
stopInstrumentingPushState() | ||
stopInstrumentingReplaceState() | ||
removeListener() | ||
}, | ||
} | ||
return { stop } | ||
} | ||
@@ -56,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20040
979231
+ Added@datadog/browser-core@3.6.11(transitive)
- Removed@datadog/browser-core@3.6.10(transitive)
Updated@datadog/browser-core@3.6.11