universal-parallax icon indicating copy to clipboard operation
universal-parallax copied to clipboard

Can't export

Open sashor opened this issue 5 years ago • 2 comments

Hello,

First, thanks for this awesome lib! I would like to use it using "import ..." instead of including it with a script tag. Any reason why you didn't expose the function with an "export .... "?

sashor avatar Jan 07 '19 10:01 sashor

Hi,

Thank you @sashor, really glad you like it!

Haven't thought of it tbh. I really should've been working a bit more on it, but if you want to update it please feel free to do so :)

marrio-h avatar Jan 07 '19 22:01 marrio-h

I wasn't sure how to achieve what I need while keeping the vanilla js simplicity of your lib (👌), without making it go through babel and stuff to remain ok on all browsers.

So what I did is put the universalParallax var in window (in your lib).

And on my side, importing it normally like I would but call new window.universalParallax().init... and it does the trick for my kind of use case with minor change and without breaking anything for others.

I can try to push that when I get some time to test it out of my scope if you don't.

sashor avatar Jan 10 '19 09:01 sashor