44 * Licensed under the MIT license
55 */
66
7- ; ( function ( factory ) {
8- 'use strict' ;
7+ ; ( function ( root , factory ) {
98 if ( typeof define === 'function' && define . amd ) {
10- define ( [ 'jquery' , 'file-saver' , 'xlsx' ] , function ( $ , fs , xlsx ) {
11- return factory ( window , $ , fs . saveAs , xlsx . XLSX ) ;
12- } ) ;
13- } else if ( typeof exports !== 'undefined' ) {
14- module . exports = factory ( window , require ( 'jquery' ) , require ( 'file-saver' ) . saveAs , require ( 'xlsx' ) . XLSX ) ;
9+ // AMD
10+ define ( [ 'jquery' , 'file-saver' , 'xlsx' ] , factory ) ;
11+ } else if ( typeof exports === 'object' ) {
12+ // Node, CommonJS-like
13+ module . exports = function ( root , jQuery ) {
14+ if ( jQuery === undefined ) {
15+ jQuery = typeof window !== 'undefined' ? require ( 'jquery' ) : require ( 'jquery' ) ( root ) ;
16+ }
17+ return factory ( jQuery , require ( 'file-saver' ) , require ( 'xlsx' ) ) ;
18+ } ;
1519 } else {
16- factory ( window , window . jQuery , window . saveAs , window . XLSX )
20+ // Browser globals (root is window)
21+ root . TableExport = factory ( root . jQuery , root . saveAs , root . XLSX )
1722 }
18- } ( function ( window , $ , saveAs , XLSX ) {
23+ } ( this , function ( $ , saveAs , XLSX ) {
24+ console . log ( saveAs , XLSX ) ;
1925 'use strict' ;
20-
2126 /**
2227 * TableExport main plugin constructor
2328 * @param selectors {jQuery} jQuery selector(s)
420425 return new TableExport ( this , options , isUpdate ) ;
421426 } ;
422427
428+ return TableExport ;
429+
423430 }
424431) ) ;
0 commit comments