Skip to content

Release 0.7.1#173

Merged
KristjanESPERANTO merged 10 commits intoshbatm:masterfrom
KristjanESPERANTO:develop
Jan 1, 2026
Merged

Release 0.7.1#173
KristjanESPERANTO merged 10 commits intoshbatm:masterfrom
KristjanESPERANTO:develop

Conversation

@KristjanESPERANTO
Copy link
Collaborator

Documentation

Code Refactoring

  • eliminate bind/call pattern in favor of clean context object (3724e7e)
  • improve input validation in handleCarouselGoto (e445370)
  • split setUpTransitionTimers into focused helper methods (20b89c5)
  • unify timer management to use only setTimeout (c838ae2)

Chores

  • add automated versioning and changelog generation (43037f2)
  • introduce eslint-plugin-jsdoc and handle found issues (c553e2a)
  • replace husky with simple-git-hooks for pre-commit linting (916bc42)
  • update devDependencies (3cacc00)
  • update Node.js setup action to v6 in automated tests workflow (2e0963f)

Replace confusing bind/call pattern where modules array was used as `this`
context with a clean object-oriented approach:

- Remove global carouselInstance variable (no longer needed)
- buildModulesContext() now returns clean context object instead of
  mutating array with properties
- moduleTransition() uses this.modulesContext instead of array-as-this
- Extract selectWrapper() as standalone method
- Simplify showModulesForSlide() to use for...of loops
- manualTransition as arrow function closure

Benefits:
- Clearer code: this always refers to carousel instance
- Better separation: modules array vs configuration object
- More maintainable: standard OOP pattern
- Easier to understand: no "clever" bind/call tricks
Replace mixed setInterval/setTimeout approach with recursive setTimeout
pattern for cleaner and more maintainable timer management.

Changes:
- Remove all setInterval usage, use only setTimeout
- Remove all clearInterval calls, only clearTimeout needed
- Centralize timer logic in scheduleNextTransition()
- Remove setupAutomaticTransitions() helper (no longer needed)
- Schedule next transition after fade completes in moduleTransition()
- Simplify restartTimer() to delegate to scheduleNextTransition()
- Remove unused defaultTimer from context object
- Remove timer parameter from buildModulesContext()

Benefits:
- Single timer type = simpler code
- No timer type confusion (interval vs timeout)
- All timer modes handled in one place
- More flexible per-transition timing
- No setInterval drift issues
- Replace parseInt() with Number() for cleaner type conversion
- Add explicit validation using Number.isInteger() and bounds checking
- Use guard clause pattern instead of try/catch blocks
- Simplify object validation (payload && payload.slide)
- Reduce from 18 to 16 lines while improving robustness
@KristjanESPERANTO KristjanESPERANTO merged commit f2f4857 into shbatm:master Jan 1, 2026
1 check passed
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.

1 participant