progressively
progressively copied to clipboard
Update build system & fix #22
First off, thank you for such amazing library. I've been using this lib for some small project, but the bug in #22 are so annoying that I decided to fix it myself. So here we are:
[JS]
- Fix Issue #22
- Using webpack, babel to build & bundle js target UMD library
- Rewrite code in ES6 and CommonJS style
[CSS]
- Switch to PostCSS and Autoprefixer
- Add missing "!" in copyright comment, to prevent that comment be tripout
(That were a lot of changes, sorry. I just want to help you upgrade the code to newer, modern style and don't mean to offend anyone. Please let me know what you think about this PR 😄)
This is a much-needed PR @Toanzzz. Thanks for your time and effort! Give me a day or two and I'll merge this after reviewing changes.
That was a quick reply thinkker3197. Sorry that I kind of take it my way and add so many things. If you think any changes are unnecessary, please feel free to edit them (and I'll appreciated if you let me know how to improve it)
@Toanzzz First, thanks for the correction, and I'm sorry for the way of writing, I'm Brazilian and I'm using google translator.
I believe I encountered an error on line 212. SecondaryObject did not exist. I added the following code to verify.
for (const prop in primaryObject) { Â Â Â Â o [prop] = (secondaryObject! = null && secondaryObject.hasOwnProperty (prop))? secondaryObject [prop]: primaryObject [prop] Â Â }
@dallington that extend
function that cause the error is the original one that I extracted and move to bottom. I checked and it only used once when initializing the settings. I believe we can use ES6's spread operator for this kind of thing:
// Original
self._settings = extend(self._settings, options)
// ES6
self._settings = { ...self._settings, ...options}
With this we don't have to check anything :)