Skip to content
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

Type browser #4909

Merged
merged 2 commits into from
Jun 30, 2017
Merged

Type browser #4909

merged 2 commits into from
Jun 30, 2017

Conversation

jfirebaugh
Copy link
Contributor

  • Switched to object literal so we can use get rather than Object.defineProperty.
  • Add @module declaration to util.js to work around a documentation.js bug.
  • Require mapbox-gl-supported in index.js directly

Copy link
Contributor

@anandthakker anandthakker left a comment

Choose a reason for hiding this comment

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

👍 approving notwithstanding my minor question re IIFE

return window.performance.now.bind(window.performance);
} else {
return Date.now.bind(Date);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use the immediately invoked function expression (IIFE) here (and below in frame, cancelFrame) rather than declaring const now = (window.performance && window.performance.now) ? window.performance.now.bind(window.performance) : Date.now.bind(Date); prior to defining the exported object?

No strong objection to this, but all else being equal, I think IIFE is maybe a bit less readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keeps the initialization scoped to the relevant property and avoids extra variables at module scope. Although, given that other parts of the module want to use now, frame, etc., it probably is better to have local variables. I'll change this.

Switched to object literal so we can use `get` rather than `Object.defineProperty`.

Add @module declaration to util.js to work around a documentation.js bug.
@jfirebaugh jfirebaugh merged commit 24b4f6a into master Jun 30, 2017
@jfirebaugh jfirebaugh deleted the type-browser branch June 30, 2017 00:49
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.

2 participants