Adding buttons dynamically?
LeaVerou opened this issue · comments
Hi there,
Thanks for this great project!
Is there any way to add Github buttons dynamically? Any API method I can call or something?
There is no directly callable JavaScript API yet, but I will put it into consideration.
Coming soon in next version.
To give you a preview:
https://github.com/ntkme/github-buttons/tree/develop#advanced-usage
And you can try it with:
npm install git+https://github.com/ntkme/github-buttons.git#develop
Yay, thanks!
Though ES6 modules are not supported in many browsers yet, so telling people to use that syntax is a bit misleading :/
IMO that's even worse, as it introduces a rather large dependency, in fact, RequireJS is bigger than your entire script! At least with ES6 modules it's all supported natively and with much more elegant syntax, just not very broadly (yet).
Not sure what's the issue be with a good ol' window.GithubButtons
. No dependencies, no boilerplate, supported everywhere. It's not like there are many other scripts called GithubButtons in the world that one needs to guard against all these possible collisions. Don't get me wrong, I love ES6 modules as much as the next dev. But until they're fully supported, I find it a bit ugly to have a dependency just for module loading and prefer to go the old one global per library way (in the browser, that is. NodeJS is another story.). But that's just me and YMMV.
I hate RequireJS / AMD just like you do.
It is intended to be used with a module bundler. In that case, it only produces a fairly small overhead.