Throw an error when framework loads twice

Fixes #2379
This commit is contained in:
Samuel Georges 2017-02-05 06:49:11 +11:00
parent 562f60730f
commit d2082e0ea0

View File

@ -2,11 +2,15 @@
* OctoberCMS: front-end JavaScript framework * OctoberCMS: front-end JavaScript framework
* http://octobercms.com * http://octobercms.com
* ======================================================================== * ========================================================================
* Copyright 2016 Alexey Bobkov, Samuel Georges * Copyright 2017 Alexey Bobkov, Samuel Georges
* ======================================================================== */ * ======================================================================== */
if (window.jQuery === undefined) if (window.jQuery === undefined) {
throw new Error('The jQuery library is not loaded. The OctoberCMS framework cannot be initialized.'); throw new Error('The jQuery library is not loaded. The OctoberCMS framework cannot be initialized.');
}
if (window.jQuery.request !== undefined) {
throw new Error('The OctoberCMS framework is already loaded.');
}
+function ($) { "use strict"; +function ($) { "use strict";
@ -17,7 +21,7 @@ if (window.jQuery === undefined)
/* /*
* Validate handler name * Validate handler name
*/ */
if (handler == undefined) { if (handler === undefined) {
throw new Error('The request handler name is not specified.') throw new Error('The request handler name is not specified.')
} }