mirror of
https://github.com/zhigang1992/bootstrap-tokenfield.git
synced 2026-01-12 17:12:44 +08:00
Explain module.exports
This commit is contained in:
11
js/bootstrap-tokenfield.js
vendored
11
js/bootstrap-tokenfield.js
vendored
@@ -9,13 +9,12 @@
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// For CommonJS and CommonJS-like environments where a proper window is present,
|
||||
// execute the factory and get jQuery
|
||||
// For CommonJS and CommonJS-like environments where a window with jQuery
|
||||
// is present, execute the factory with the jQuery instance from the window object
|
||||
// For environments that do not inherently posses a window with a document
|
||||
// (such as Node.js), expose a jQuery-making factory as module.exports
|
||||
// This accentuates the need for the creation of a real window
|
||||
// e.g. var jQuery = require("jquery")(window);
|
||||
// See ticket #14549 for more info
|
||||
// (such as Node.js), expose a Tokenfield-making factory as module.exports
|
||||
// This accentuates the need for the creation of a real window or passing in a jQuery instance
|
||||
// e.g. require("bootstrap-tokenfield")(window); or require("bootstrap-tokenfield")($);
|
||||
module.exports = global.window && global.window.$ ?
|
||||
factory( global.window.$ ) :
|
||||
function( input ) {
|
||||
|
||||
Reference in New Issue
Block a user