progressively icon indicating copy to clipboard operation
progressively copied to clipboard

Update build system & fix #22

Open Toanzzz opened this issue 6 years ago • 4 comments

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 😄)

Toanzzz avatar Jun 09 '18 22:06 Toanzzz

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.

thinker3197 avatar Jun 10 '18 04:06 thinker3197

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 avatar Jun 10 '18 11:06 Toanzzz

@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 avatar Dec 01 '18 14:12 dallington

@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 :)

Toanzzz avatar Dec 01 '18 15:12 Toanzzz