File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/telemetry/browser-telemetry/src/collectors/dom Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const THROTTLE_TIME_MS = 1000;
99const INPUT_TAG_NAMES = [ 'INPUT' , 'TEXTAREA' ] ;
1010
1111/**
12- * Collects mouse click events and adds them as breadcrumbs.
12+ * Collects key press events and adds them as breadcrumbs.
1313 */
1414export default class KeypressCollector implements Collector {
1515 private _destination ?: Recorder ;
@@ -53,10 +53,12 @@ export default class KeypressCollector implements Collector {
5353 }
5454
5555 private _shouldDeduplicate ( crumb : Breadcrumb ) : boolean {
56- // TODO: Consider de-duplication at the dom level.
56+ // If this code every is demonstrably a performance issue, then we may be able to implement
57+ // some scheme to de-duplicate these via some DOM mechanism. Like adding a debounce annotation
58+ // of some kind.
5759 if ( this . _lastEvent ) {
5860 const timeDiff = Math . abs ( crumb . timestamp - this . _lastEvent . timestamp ) ;
59- return this . _lastEvent . message === crumb . message && timeDiff <= THROTTLE_TIME_MS ;
61+ return timeDiff <= THROTTLE_TIME_MS && this . _lastEvent . message === crumb . message ;
6062 }
6163 return false ;
6264 }
You can’t perform that action at this time.
0 commit comments