ckan.js
ckan.js copied to clipboard
Undocumented dependency on JQuery?
Readme.md doesn't mention a JQuery dependency, but the library is failing when I don't have JQuery loaded.
@davidmegginson are you using this from browser or node? In node should not require jquery.
@rgrp I was using it in-browser, for a client-only app.
If that's the only JQuery dependency, then it might make sense to add a couple of extra lines of Javascript to do AJAX the old-fashioned way, and make the library standalone.
@davidmegginson that's definitely a thought :-) - only trouble is that can be a little bit painful (e.g. if you need to add auth headers etc).
What's definitely missing right now is a something in the README about needing jquery - if you have a suggestion there please open a pull request or we can add it at our end :-)
Thanks for flagging this!
I don't think this library should depend on jquery. Maybe there are smaller libraries made just for that purpose (AJAX).
I agree with @letmaik - and in today's PR #34 proposed to use the lightweight needle-js library. Can we completely remove the need for jQuery, perhaps even abstract the Ajax call to allow the user to use whatever is already part of their stack?
@loleg yes we can completely remove and also happy for us to use what is in people's stack - if there is a clean way to do that.
On further thought, superagent is the only modern library with JSONP support (albeit undocumented), the reason I've been continuing to use jQuery in ckan-embed.
Would it potentially make sense to abstract away the HTTP request, so the library user can plug in whatever they want, with perhaps just a sensible default? If anyone with experience in the various options out there can weigh in here, please do.
@loleg happy for you to lead here and make a proposal - if superagent seems good to you happy to go for that.