use requirejs if available

This commit is contained in:
vangheem 2015-02-10 16:21:17 -06:00
parent c933d261e2
commit ad3953f794
2 changed files with 15 additions and 2 deletions

View File

@ -4,6 +4,9 @@ Changelog
2.4.0 (unreleased) 2.4.0 (unreleased)
------------------ ------------------
- use requirejs if available
[vangheem]
- Rename @@discussion-settings to @@discussion-controlpanel - Rename @@discussion-settings to @@discussion-controlpanel
[maartenkling] [maartenkling]

View File

@ -3,7 +3,17 @@
* jQuery functions for the plone.app.discussion comment viewlet and form. * jQuery functions for the plone.app.discussion comment viewlet and form.
* *
******************************************************************************/ ******************************************************************************/
(function ($) {
if(require === undefined){
require = function(reqs, torun){
'use strict';
return torun(window.jQuery);
}
}
require([
'jquery'
], function ($) {
// This unnamed function allows us to use $ inside of a block of code // This unnamed function allows us to use $ inside of a block of code
// without permanently overwriting $. // without permanently overwriting $.
// http://docs.jquery.com/Using_jQuery_with_Other_Libraries // http://docs.jquery.com/Using_jQuery_with_Other_Libraries
@ -249,4 +259,4 @@
//#JSCOVERAGE_ENDIF //#JSCOVERAGE_ENDIF
}(jQuery)); });