-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
docs: improve JSDoc documentation in utils.js #32743
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
base: dev
Are you sure you want to change the base?
Conversation
- Add comprehensive JSDoc comments for array utility functions (arrayMin, arrayMax, arrayNeedsUint32) - Document typed array utilities (TYPED_ARRAYS constant and getTypedArray function) - Add documentation for DOM element creation functions (createElementNS, createCanvasElement) - Document console logging system (setConsoleFunction, getConsoleFunction, log, warn, error, warnOnce) - Add detailed JSDoc for WebGL synchronization function (probeAsync) - Document projection matrix conversion functions (toNormalizedProjectionMatrix, toReversedProjectionMatrix) - Include parameter types, return types, and detailed descriptions for all documented functions This improves code maintainability and helps developers understand the purpose and usage of utility functions.
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
| * | ||
| * @param {Array<number>} array - The array to search for the minimum value. | ||
| * @return {number} The minimum value in the array, or Infinity if the array is empty. | ||
| */ |
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.
Except for createCanvasElement(), setConsoleFunction(), getConsoleFunction(), log(), warn(), error(), warnOnce(), none of these functions are part of the public API so add the @private tag to them.
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.
You mean that Except for createCanvasElement(), setConsoleFunction(), getConsoleFunction(), log(), warn(), error(), warnOnce(), add @Private tag?
src/utils.js
Outdated
| * display style set to 'block', which is commonly used in three.js | ||
| * rendering contexts to avoid inline element spacing issues. | ||
| * | ||
| * @private |
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.
The exported functions should not be private, see
Line 162 in e90650f
| export { createCanvasElement, setConsoleFunction, getConsoleFunction, log, warn, error, warnOnce } from './utils.js'; |
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.
all exported functions should not be private?
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.
Yes, these can be used by the developer and should be part of the public documentation.
| * Map of typed array constructor names to their constructors. | ||
| * This mapping enables dynamic creation of typed arrays based on string type names. | ||
| * | ||
| * @constant |
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.
This should be private as well.
As requested by @Mugen87, added @Private tag to functions that are not part of the public API: - arrayMin, arrayMax, arrayNeedsUint32 - getTypedArray - createCanvasElement - probeAsync - toNormalizedProjectionMatrix, toReversedProjectionMatrix Public API functions (without @Private): - createElementNS, setConsoleFunction, getConsoleFunction - log, warn, error, warnOnce
|
I have fixed feedback. Please check |
|
This ins't correct since a lot of private tags are missing. |
As requested by @Mugen87, added @Private tags to functions that are NOT part of the public API. Public API functions (no @Private): - createCanvasElement, setConsoleFunction, getConsoleFunction - log, warn, error, warnOnce Private functions (with @Private): - arrayMin, arrayMax, arrayNeedsUint32 - getTypedArray, createElementNS - probeAsync - toNormalizedProjectionMatrix, toReversedProjectionMatrix - TYPED_ARRAYS constant
Fixed this. Could you check again please? |
|
@Mugen87 |
| /** | ||
| * Internal cache for tracking warning messages to prevent duplicate warnings. | ||
| * | ||
| * @type {Object<string, boolean>} |
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.
This should be private as well.
| /** | ||
| * Custom console function handler for intercepting log, warn, and error calls. | ||
| * | ||
| * @type {Function|null} |
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.
And add private here.
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.
Fixed this.
Added @Private tags to: - _cache constant (internal warning message cache) - _setConsoleFunction variable (internal console function handler) These are internal implementation details and should be marked as private.
|
Hi. |
This improves code maintainability and helps developers understand the purpose and usage of utility functions.
Related issue: #XXXX
Description
A clear and concise description of what the problem was and how this pull request solves it.
This contribution is funded by Example