Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
3pia
VISPA
VISPA web
Commits
213e724c
Commit
213e724c
authored
Oct 16, 2015
by
marcel
Browse files
Load extensions on client-side only if its extension.js file exists.
parent
569f17ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
vispa/static/js/extensions.js
View file @
213e724c
...
...
@@ -40,16 +40,21 @@ define(["jquery", "emitter", "vispa/module", "vispa/ui"], function($, Emitter, M
loadExtension
:
function
(
name
)
{
var
self
=
this
;
this
.
extensionsLoading
++
;
require
([
"
extensions/
"
+
name
+
"
/static/js/extension
"
],
this
.
registerExtension
.
bind
(
this
),
function
(
err
)
{
// check if the entry point, i.e. the extension.js file, exists
var
entryPoint
=
"
extensions/
"
+
name
+
"
/static/js/extension
"
;
$
.
ajax
({
url
:
entryPoint
+
"
.js
"
,
type
:
"
HEAD
"
}).
fail
(
function
()
{
self
.
_checkExtensionsLoaded
();
}).
done
(
function
()
{
require
([
entryPoint
],
self
.
registerExtension
.
bind
(
self
),
function
(
err
)
{
if
(
vispa
.
args
.
global
.
devMode
)
{
self
.
logger
.
error
(
"
extension '%s' failed to load due to: %s
"
,
err
.
requireModules
[
0
].
split
(
"
/
"
)[
1
],
err
.
requireType
);
}
self
.
_checkExtensionsLoaded
();
});
});
},
start
:
function
start
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment