francoischalifour / medium-zoom

🔎🖼 A JavaScript library for zooming images like Medium
https://medium-zoom.francoischalifour.com
MIT License
3.58k stars 162 forks source link

refactor: standalone utils #96

Closed meteorlxy closed 5 years ago

meteorlxy commented 5 years ago

Summary

This PR just extract util functions from medium-zoom.js to utils.js.

I took some time to figure out the code structure. Use a standalone utils.js could make the code clearer.

Just close it if you don't like the refactor.

francoischalifour commented 5 years ago

The initial reason why everything was in a single file was because the library used to be bundled with Webpack, which created too much boilerplate and increased the library size.

Now that we migrated to Rollup, we can afford these changes!

francoischalifour commented 5 years ago

If you see anything that could be improved further, feel free to keep contributing 😄