Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jQuery dependency #570

Open
HamedFathi opened this issue May 22, 2018 · 16 comments
Open

Remove jQuery dependency #570

HamedFathi opened this issue May 22, 2018 · 16 comments

Comments

@HamedFathi
Copy link

Is it possible for you to release a version without jquery as a dependency?

Nowadays developers use Aurelia, Vue, Angular for their projects and don't need jquery.

@NullVoxPopuli
Copy link

I would like this as well (in an ember app)

@adonespitogo
Copy link

adonespitogo commented Jun 11, 2018

👍
I use Svelte and need a very lighweight web app. Animations can be achieved using css3

@AStoker
Copy link
Contributor

AStoker commented Jul 26, 2018

Anybody attempt forking this and removing jquery?

@crazyredd
Copy link

It does not make sense for the author to remove the jQuery dependency - it is a lot of work and the JavaScript file will end up being much larger as a result. Also a lot of devs use this in tandem with jQuery for older projects that we cannot afford to upgrade to React/Angular setups.
I would suggest you either find another toast/notification library or fork this and modify it for your framework of choice.

@AStoker
Copy link
Contributor

AStoker commented Aug 10, 2018

If you're using it in tandem, makes sense. If not, your overall javascript file would decrease a good proportion as you're cutting out an entire library. Yes, jQuery is used frequently, but it would be incorrect to say that most sites in the wild use jQuery. My particular case is a small web app who's overall size is smaller than the jQuery library, and all I need is a simple notification library.
YouMightNotNeedJQuery is a great site for looking at how to do things natively in Javascript instead of using jQuery.
And in other news, Github removes jQuery from its website

@crazyredd
Copy link

crazyredd commented Aug 12, 2018

@AStoker You seem to have missed my point. Of course, it is entirely possible to cut out the jQuery dependency. But why should the author do so? Leaving it like that allows it to easily hook into existing projects. It makes sense to me to leave this repo as is. It is already well established as a jQuery plugin.
I am certainly not against someone forking it and removing the dependency, but I am sure there are other notification libraries out there that do exactly what you want - not every library has to work to your standards.

You may find that someone has done it already...
https://github.com/CodeSeven/toastr/network/members

@ghost
Copy link

ghost commented Aug 12, 2018

yep - keep jquery - Nothing wrong with it as it is.

@crazyredd
Copy link

Just been looking through the source. For whatever reason it supports NodeJS.
The NodeJS runtime never supplies the window or document object, so in removing jQuery, you'd also be removing NodeJS support.

@AStoker
Copy link
Contributor

AStoker commented Aug 13, 2018

I appreciate the dialog @crazyredd. Thanks for pointing out the potential window issue. I think I'll end up forking and trying to remove the dependency myself and play around with the outcome. Result should still work seamlessly with jQuery like it did before. We'll see what comes out of it 😛

@adonespitogo
Copy link

@AStoker can you provide a link to your fork - I'd like to watch and help with it

@AStoker
Copy link
Contributor

AStoker commented Aug 14, 2018

@adonespitogo, once I start taking a crack at it, I'll post it here. Would be great if I identify all the places that need to be adjusted and make a checklist so others can help out.

@AStoker
Copy link
Contributor

AStoker commented Aug 14, 2018

@adonespitogo, I just created a checklist document in a fork (a branch of a fork). Just threw it together real quick, it's more of a placeholder than anything else 😜 But it'll give you something to watch or contribute to.

@adonespitogo
Copy link

@AStoker nice list you put together. Although I'd prefer if we drop jquery dependency completely and rename it like toastr-lite(or something) since we don't use jquery. For people who use jquery, they can use the original toastr library.

Another idea is to create a subset of jquery functions that we can import as jquery poly-fill for projects that don't use jquery.

@AStoker
Copy link
Contributor

AStoker commented Aug 14, 2018

@adonespitogo, my goal would be to limit fragmentation. Maintaining toastr-lite and toastr would prove difficult. The end result should be no noticeable difference between pre-jquery dependency and post-jquery dependency. So if somebody was already using jQuery, fine, toastr still works exactly the same. And if somebody wasn't using jQuery, same goes, toastr would work just fine. Make sense?

@JPeer264
Copy link

JPeer264 commented Jan 31, 2019

As my PR (#603) is still open, I did some homework. I removed jQuery and added Typescript to toastr in my repo. I will do some unit tests as soon as I have time. But it works for me at the moment.

NPM: https://www.npmjs.com/package/toastr2
GH: https://github.com/JPeer264/toastr2

EDIT:
I still do not handle any transitions yet (had no time yet to add CSS animations)

@HamedFathi
Copy link
Author

@JPeer264

Great, Please keep up the good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants