From 8d55075e77bda7c91acbc552fc1cb28346ca6ce4 Mon Sep 17 00:00:00 2001 From: Tanner Hodges Date: Thu, 21 Jan 2016 16:08:00 -0500 Subject: [PATCH 1/2] UMD support added --- wNumb.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/wNumb.js b/wNumb.js index 722b629..c2591e2 100644 --- a/wNumb.js +++ b/wNumb.js @@ -1,4 +1,22 @@ -(function(){ +(function (factory) { + + if ( typeof define === 'function' && define.amd ) { + + // AMD. Register as an anonymous module. + define([], factory); + + } else if ( typeof exports === 'object' ) { + + // Node/CommonJS + module.exports = factory(); + + } else { + + // Browser globals + window.noUiSlider = factory(); + } + +}(function(){ 'use strict'; @@ -330,6 +348,6 @@ var } /** @export */ - window.wNumb = wNumb; + return wNumb; -}()); +})); From 896ba409889e3f46b3960a8fc115b48dc3a364d8 Mon Sep 17 00:00:00 2001 From: Tanner Hodges Date: Mon, 22 Feb 2016 13:03:15 -0500 Subject: [PATCH 2/2] Fix global namespace --- wNumb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wNumb.js b/wNumb.js index c2591e2..75c66ee 100644 --- a/wNumb.js +++ b/wNumb.js @@ -13,7 +13,7 @@ } else { // Browser globals - window.noUiSlider = factory(); + window.wNumb = factory(); } }(function(){