Skip to content

perf: reduce bundle size by introducing style setter helpers#25

Merged
kadykov merged 2 commits intomainfrom
helper-function
Oct 1, 2025
Merged

perf: reduce bundle size by introducing style setter helpers#25
kadykov merged 2 commits intomainfrom
helper-function

Conversation

@kadykov
Copy link
Owner

@kadykov kadykov commented Oct 1, 2025

  • Add setPositionAndTop helper in top.ts to consolidate position and top style assignments
  • Add setPositionAndBottom helper in bottom.ts to consolidate position and bottom style assignments
  • Reduces minified bundle size by 60 and 69 bytes for top and bottom scripts respectively.

- Add setPositionAndTop helper in top.ts to consolidate position and top style assignments
- Add setPositionAndBottom helper in bottom.ts to consolidate position and bottom style assignments
- Reduces minified bundle size by ~0.1kb for both top and bottom scripts
Copilot AI review requested due to automatic review settings October 1, 2025 10:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces helper functions to consolidate repeated style assignments in the sticky positioning logic, aiming to reduce bundle size through better code reuse.

  • Adds setPositionAndTop helper in top.ts to consolidate position and top style assignments
  • Adds setPositionAndBottom helper in bottom.ts to consolidate position and bottom style assignments
  • Replaces multiple occurrences of direct style property assignments with helper function calls

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/top.ts Introduces setPositionAndTop helper and replaces 4 instances of direct style assignments
src/bottom.ts Introduces setPositionAndBottom helper and replaces 4 instances of direct style assignments

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@kadykov kadykov merged commit c80f452 into main Oct 1, 2025
6 checks passed
@kadykov
Copy link
Owner Author

kadykov commented Oct 1, 2025

🎉 This PR is included in version 1.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kadykov kadykov deleted the helper-function branch October 1, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants