Skip to content

Conversation

@joe-replin
Copy link
Contributor

@joe-replin joe-replin commented Jan 5, 2026

Comprehensive JSDoc documentation review and enhancement of the notification system (6 files). This PR sets to begin an established style guide with clear, practical examples and identified known issues/improvements for future JSDocs.

Fix

Update

  • notify.js - Added complete module-level documentation with public API, integration points, known issues, and customization examples
  • notifyView.js - Fixed @example block in read() method; documented all public methods with parameters and working code examples
  • notifyPopupView.js - Added modal documentation and event handler details
  • notifyPushView.js - Documented push notification display behavior, positioning, and public methods
  • notifyModel.js - Documented side effects, idempotency, and async API for onClosed()
  • notifyPushCollection.js - Added queue management documentation with focus on side effects

Documentation Standards Applied

What Gets Documented:

  • Functions and methods - With @param, @returns, @example
  • Classes and modules - With @class, @classdesc, @module, @file
  • Singletons - As services with clear APIs
  • File-level descriptions - Purpose, responsibility, integration points
  • Public APIs - Everything plugins can safely use
  • Complex algorithms - With explanatory comments and examples

What Gets Skipped:

  • Configuration methods - defaults(), className(), attributes(), tagName(), events()
  • Obvious helper methods - preRender(), postRender(), render(), etc. where name + code are self-explanatory
  • Variables and constants - Simple assignments, magic numbers
  • Private properties - Internal state like this._stack, this.hasOpened
  • Enums - Individual enum values (document the file, not each constant)
  • Event listeners - No @listens tags (wiring is obvious from code)
  • Event definitions - No @event tags (redundant with @fires)
  • Internal/private events - Only document public API events
  • Framework events - Backbone's change, sync, etc.
  • Implementation details - How it works internally (use inline comments instead)
  • Abstract "extension points" - Don't list WHAT can be customized; show HOW in examples

Testing

  1. Verify all 6 files are valid JSDoc:

    npm run build  # Ensures JSDoc parsing succeeds
  2. Check style guide compliance:

    • Verify all code examples contain executable code
    • Check that framework methods are not over-documented
  3. Validate documentation structure:

    • Open each notify file and confirm:
      • File-level documentation is present
      • "Known Issues & Improvements" section exists
      • All public methods are documented with working examples
      • Private methods are marked as private
      • Public events are documented
  4. Test specific changes:

    • notify.js: Verify examples work with Adapt API
    • notifyView.js: Confirm read() method is properly documented
    • notifyPopupView.js: Check modal lifecycle documentation
    • notifyPushView.js: Verify positioning behavior is clear
    • notifyModel.js: Check async API is documented
    • notifyPushCollection.js: Confirm queue behavior is clear
  5. Clarity Check:

    • Review documentation for clarity and completeness
    • Verify code examples are clear and work as intended
    • Confirm integration points are easy to understand

Added detailed JSDoc documentation to notification-related files, including models, collections, views, and the main notification service. The comments describe module responsibilities, public APIs, integration points, known issues, and usage examples, improving code maintainability and developer onboarding.
Comment on lines 89 to 95
* @example
* const model = new NotifyModel({
* body: 'Delayed message',
* _delay: 1000
* });
* collection.add(model);
*/
Copy link
Member

Choose a reason for hiding this comment

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

The only handle to a NotifyPushCollection is at notify.notifyPushes, NotifyPushCollection would not be instantiated by a developer.

We would use notify.push(options) instead of notify.notifyPushes.add(model).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in c675983

Copy link
Member

@oliverfoster oliverfoster left a comment

Choose a reason for hiding this comment

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

Lovely

initialize({ notify }) {
this.notify = notify;
_.bindAll(this, 'onShadowClicked', 'resetNotifySize', 'onKeyDown');

Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary whitespace addition.

* _showIcon: true
* });
*
* Adapt.on('course:save', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Same issue with not detaching handlers. Please correct for all cases where Adapt.on is not followed by Adapt.off clearup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Reviewing

Development

Successfully merging this pull request may close these issues.

JSDocs - Core Notification System

3 participants