Skip to content

chore(Common): update the Common.now#55

Closed
xballoy wants to merge 5 commits into
liabru:masterfrom
xballoy:master
Closed

chore(Common): update the Common.now#55
xballoy wants to merge 5 commits into
liabru:masterfrom
xballoy:master

Conversation

@xballoy
Copy link
Copy Markdown

@xballoy xballoy commented Dec 29, 2014

On IE9, perf.now doesn't exists and it throw an error. I updated the
function to mach with the gist

On IE9, perf.now doesn't exists and it throw an error. I updated the
function to mach with the gist
Comment thread src/core/Common.js Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should rewrite this line to simply be a reference to Date.now. It outperforms creating a new Date instance and it makes the code cleaner.

Date.now is supported by all ECMAScript 5 browsers (IE 9+).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is migrated to Date.now then it should be compatibility checked as well and Date.getTime() should still be a fallback. Not all clients are capable of supporting IE9+; we use Matter.js on IE6, for instance.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case yes, you could add it as a check before defaulting to new Date().getTime()

@liabru liabru closed this in 8555c0c May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants