1
0
mirror of synced 2024-11-22 13:06:08 +03:00

Better handle AMD across files

Now that `define` and `require` are never made public, we have to
build everything to support `$.fn.select2.amd` while also working
with other AMD loaders.
This commit is contained in:
Kevin Brown 2014-10-31 21:10:40 -04:00
parent 8b77dcab98
commit 65875bf8e7
8 changed files with 16 additions and 16 deletions

View File

@ -1,4 +1,4 @@
(function() {define('select2/utils',[], function () { (function() { if ($ && $.fn && $.fn.select2 && $.fn.select2.amd) { define = $.fn.select2.amd.define; require = $.fn.select2.amd.require; }define('select2/utils',[], function () {
var Utils = {}; var Utils = {};
Utils.Extend = function (ChildClass, SuperClass) { Utils.Extend = function (ChildClass, SuperClass) {
@ -1674,4 +1674,4 @@ define('jquery.select2',[
return Select2; return Select2;
}); });
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}()); require('jquery.select2'); $.fn.select2.amd = { define: define, require: require };}());

View File

@ -1,4 +1,4 @@
(function() {define('select2/utils',[], function () { (function() { if ($ && $.fn && $.fn.select2 && $.fn.select2.amd) { define = $.fn.select2.amd.define; require = $.fn.select2.amd.require; }define('select2/utils',[], function () {
var Utils = {}; var Utils = {};
Utils.Extend = function (ChildClass, SuperClass) { Utils.Extend = function (ChildClass, SuperClass) {
@ -1674,4 +1674,4 @@ define('jquery.select2',[
return Select2; return Select2;
}); });
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}()); require('jquery.select2'); $.fn.select2.amd = { define: define, require: require };}());

View File

@ -1,4 +1,4 @@
(function() {/** (function() { if ($ && $.fn && $.fn.select2 && $.fn.select2.amd) { define = $.fn.select2.amd.define; require = $.fn.select2.amd.require; }/**
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details * see: http://github.com/jrburke/almond for details
@ -11209,4 +11209,4 @@ define('jquery.select2',[
return Select2; return Select2;
}); });
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}()); require('jquery.select2'); $.fn.select2.amd = { define: define, require: require };}());

File diff suppressed because one or more lines are too long

4
dist/js/select2.js vendored
View File

@ -1,4 +1,4 @@
(function() {/** (function() { if ($ && $.fn && $.fn.select2 && $.fn.select2.amd) { define = $.fn.select2.amd.define; require = $.fn.select2.amd.require; }/**
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details * see: http://github.com/jrburke/almond for details
@ -2102,4 +2102,4 @@ define('jquery.select2',[
return Select2; return Select2;
}); });
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}()); require('jquery.select2'); $.fn.select2.amd = { define: define, require: require };}());

File diff suppressed because one or more lines are too long

View File

@ -372,7 +372,7 @@ $("[data-fill-from]").each(function () {
prettyPrint(); prettyPrint();
require(["select2/core", "select2/utils"], function (Select2, Utils) { $.fn.select2.amd.require(["select2/core", "select2/utils"], function (Select2, Utils) {
var $basicSingle = $(".js-example-basic-single"); var $basicSingle = $(".js-example-basic-single");
var $basicMultiple = $(".js-example-basic-multiple"); var $basicMultiple = $(".js-example-basic-multiple");

View File

@ -1,4 +1,4 @@
{ {
"start": "(function() {", "start": "(function() { if ($ && $.fn && $.fn.select2 && $.fn.select2.amd) { define = $.fn.select2.amd.define; require = $.fn.select2.amd.require; }",
"end": "require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define, require: require };}());" "end": "require('jquery.select2'); $.fn.select2.amd = { define: define, require: require };}());"
} }