Skip to content

Commit fa7e647

Browse files
committed
Use Date.now() for better browser compatibility
1 parent f479940 commit fa7e647

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/core/ripple/ripple-renderer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const RIPPLE_FADE_OUT_DURATION = 400;
2121
* Timeout for ignoring mouse events. Mouse events will be temporary ignored after touch
2222
* events to avoid synthetic mouse events.
2323
*/
24-
const ignoreMouseEventsTimeout = 800;
24+
const IGNORE_MOUSE_EVENTS_TIMEOUT = 800;
2525

2626
export type RippleConfig = {
2727
color?: string;
@@ -190,7 +190,7 @@ export class RippleRenderer {
190190
/** Function being called whenever the trigger is being pressed using mouse. */
191191
private onMousedown(event: MouseEvent) {
192192
const isSyntheticEvent = this._lastTouchStartEvent &&
193-
event.timeStamp < this._lastTouchStartEvent + ignoreMouseEventsTimeout;
193+
Date.now() < this._lastTouchStartEvent + IGNORE_MOUSE_EVENTS_TIMEOUT;
194194

195195
if (!this.rippleDisabled && !isSyntheticEvent) {
196196
this._isPointerDown = true;
@@ -204,7 +204,7 @@ export class RippleRenderer {
204204
// Some browsers fire mouse events after a `touchstart` event. Those synthetic mouse
205205
// events will launch a second ripple if we don't ignore mouse events for a specific
206206
// time after a touchstart event.
207-
this._lastTouchStartEvent = event.timeStamp;
207+
this._lastTouchStartEvent = Date.now();
208208
this._isPointerDown = true;
209209

210210
this.fadeInRipple(event.touches[0].clientX, event.touches[0].clientY, this.rippleConfig);

0 commit comments

Comments
 (0)