Skip to content

Commit f9384f8

Browse files
authored
Safari fix
1 parent a0572a0 commit f9384f8

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

changelog.MD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Call destroy method on initialization to prevent errors with existing ones
55
- Added a update Method to edit settings after initialization
66
- Bugfix: links where not collected correctly in Internet Explorer
7+
- Bugfix: window.performance fix on old Safari's
78
- Remove Deprecated warnings
89
- cleaned up some functions
910

dist/scrolltosmooth.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,9 @@ var scrollToSmooth = (function() {
584584
*/
585585

586586
var getTime = function getTime() {
587-
return "now" in w.performance ? performance.now() : new Date().getTime();
587+
return w.performance && "now" in w.performance
588+
? performance.now()
589+
: new Date().getTime();
588590
};
589591
/**
590592
* Determine element baseURI

dist/scrolltosmooth.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/scrolltosmooth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default class scrollToSmooth {
6868
/**
6969
* Get the current Timestamp
7070
*/
71-
let getTime = () => 'now' in w.performance ? performance.now() : new Date().getTime();
71+
let getTime = () => (w.performance && 'now' in w.performance) ? performance.now() : new Date().getTime();
7272

7373
/**
7474
* Determine element baseURI

0 commit comments

Comments
 (0)