Open pierrehenri220 opened 5 years ago
Yeah @ganlanyuan would be nice to support AMD by default
So agree. Beautiful slider, but doesn't play well with module definitions. Rather than put tns in the global space, simple UMD wrapper would solve the issue and not break any current implementation.
(function(root, factory) { //figure out the environment... if ( typeof define === 'function' && define.amd ) { //1. amd -- I prefer it be named versus anonymous but either works define([], factory); } else if ( typeof exports === 'object' ) { //2. module.exports module.exports = factory.call(root); } else { //3. browser or global space root.tns = factory.call(root); } }(this, function() { // original code here except replace "var tns = " with "return " }));
Would be great - push :-)
Good Day,
I'm currently adding the following code at the end of tiny-slider.min.js to make it work with requirejs:
Then in my main script I'm using it like this:
But that would be great if you can add the standard AMD loading code in the script itself to make it compatible by default :-)
Not in a hurry, thank you very much in advance and thank you for your time
Regards