New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance Port: Adds Performance.now, Performance.mark, & Date.now #5
Conversation
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now | ||
*/ | ||
// Cache references for speed and to guard against shenanigans | ||
var nativeDate = global.Date; // TODO: where does global come from? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't yet decided on how we want to handle global
/ window
handling.
Needs a solution before accepting PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, let's open a separate PR that adds a module like https://github.com/bazaarvoice/scoutfile/blob/master/lib/browser/global.js. This is not optimal, but thankfully it's a one-liner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did wonder how terrible it would be to make scoutfile a dependency, to directly pull in this module, knowing full well that code using the scoutfile as a peer dependency would also be using it. It sounds like npm v3 will flatten it out safely, but would that seem like a reasonable approach to getting at global (and also in the future, things like IE detection if needed etc)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how Webpack will end up consolidating those, but I'm open to it if there's a good story there.
Oooh, that's a cool tool. I'll add that to the main documentation if it's not already there. Looks like the native implementations aren't being covered, which makes sense at this point because in order for us to use them, Likely won't be able to get full coverage on these until we add browser tests. |
This PR also relies on the |
Once the global module is available, we can likely use |
Note that there's now a pull request open to get browser tests working, which involves a switch from tap to tape. This will need to be adapted in a very minor way to work with that. |
Performance Port: removes use strict declarations Performance Port: Fixes linting errors and require paths Performance Port: restructures the directory structure and adds performance.mark module and tests Performance Port - restructures directory, updates documentation
…th the new global module
PR rebased on and adjusted for new The code coverage still isn't 100%.
I'm going to try rewire-webpack now. Update: |
JIRA
No real associated ticket, but is a part of https://bits.bazaarvoice.com/jira/browse/SCP-1281
Details
This PR ports the
performance.now
,performance.mark
, anddate.now
modules out offirebird
and intobv-ui-core
.The modules use the native
Navigation Timing API
when available and provide polyfills when necessary. They provide a consistent interface to callers so that the underlying implementation details aren't of concern to calling code.Verification
Run the tests:
npm run test
All tests should pass.