social-share-kit icon indicating copy to clipboard operation
social-share-kit copied to clipboard

Better module system compatibility

Open micky2be opened this issue 7 years ago • 3 comments

Would be nice to add a better module system compatibility.

What I mean is that I kinda hate libraries adding themselves on the window object. All I need is the possibility to require or import the module .

It also shouldn't need to parse my html during an init, but I should be able to call myself shareOnTwitter when an action is done on an DOM of my choice.

This would make the library compatible with framework like React.

micky2be avatar Aug 19 '16 07:08 micky2be

I am not familiar with neither require or import, so I won't be able to implement such changes. However if you decide to make a PR, make sure this library works without require or import too. I kinda hate when sometimes for small script, you have to include 100x heavier dependency or some kind of package manager.

About init part, not sure what do you meant, you can call init() whenever you feel like it, yes it will attach events to all icons at the same time, but that is the main point, to have everything automatically, it is very rare occasion to have only single twitter icon, and even then, you can specify your own selector to target only one element.

darklow avatar Aug 19 '16 09:08 darklow

I take my words back :) I will try to make it compatible with require and import in nearest time and if won't take too much extra code and weight I will include it.

darklow avatar Dec 16 '16 10:12 darklow

if someone need this , i just add a pull request using this branch https://github.com/arfilon/social-share-kit

arfilon avatar May 10 '17 04:05 arfilon