Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
renderjs
Commits
ca47096f
Commit
ca47096f
authored
May 17, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create monitor only when the gadget is added into the DOM.
parent
b72c73a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
renderjs.js
renderjs.js
+10
-7
No files found.
renderjs.js
View file @
ca47096f
...
@@ -447,13 +447,15 @@
...
@@ -447,13 +447,15 @@
RenderJSGadget
.
prototype
.
__required_css_list
=
[];
RenderJSGadget
.
prototype
.
__required_css_list
=
[];
RenderJSGadget
.
prototype
.
__required_js_list
=
[];
RenderJSGadget
.
prototype
.
__required_js_list
=
[];
function
deleteGadgetMonitor
(
g
)
{
g
.
__monitor
.
cancel
();
delete
g
.
__monitor
;
g
.
__job_list
=
[];
}
function
createGadgetMonitor
(
g
)
{
function
createGadgetMonitor
(
g
)
{
if
(
g
.
__monitor
!==
undefined
)
{
g
.
__monitor
.
cancel
();
}
g
.
__monitor
=
new
Monitor
();
g
.
__monitor
=
new
Monitor
();
g
.
__job_dict
=
{};
g
.
__job_dict
=
{};
g
.
__job_list
=
[];
g
.
__job_triggered
=
false
;
g
.
__job_triggered
=
false
;
g
.
__monitor
.
fail
(
function
handleGadgetMonitorError
(
error
)
{
g
.
__monitor
.
fail
(
function
handleGadgetMonitorError
(
error
)
{
if
(
!
(
error
instanceof
RSVP
.
CancellationError
))
{
if
(
!
(
error
instanceof
RSVP
.
CancellationError
))
{
...
@@ -465,10 +467,10 @@
...
@@ -465,10 +467,10 @@
function
clearGadgetInternalParameters
(
gadget
)
{
function
clearGadgetInternalParameters
(
gadget
)
{
gadget
.
__sub_gadget_dict
=
{};
gadget
.
__sub_gadget_dict
=
{};
gadget
.
__job_list
=
[];
if
(
gadget
.
__json_state
!==
undefined
)
{
if
(
gadget
.
__json_state
!==
undefined
)
{
gadget
.
state
=
JSON
.
parse
(
gadget
.
__json_state
);
gadget
.
state
=
JSON
.
parse
(
gadget
.
__json_state
);
}
}
createGadgetMonitor
(
gadget
);
}
}
function
loadSubGadgetDOMDeclaration
()
{
function
loadSubGadgetDOMDeclaration
()
{
...
@@ -586,6 +588,7 @@
...
@@ -586,6 +588,7 @@
}
}
function
startService
(
gadget
)
{
function
startService
(
gadget
)
{
createGadgetMonitor
(
gadget
);
gadget
.
__monitor
.
monitor
(
new
RSVP
.
Queue
()
gadget
.
__monitor
.
monitor
(
new
RSVP
.
Queue
()
.
push
(
function
monitorAllServiceList
()
{
.
push
(
function
monitorAllServiceList
()
{
var
i
,
var
i
,
...
@@ -1495,7 +1498,7 @@
...
@@ -1495,7 +1498,7 @@
if
(
node
.
nodeType
===
Node
.
ELEMENT_NODE
)
{
if
(
node
.
nodeType
===
Node
.
ELEMENT_NODE
)
{
if
(
node
.
hasAttribute
(
"
data-gadget-url
"
)
&&
if
(
node
.
hasAttribute
(
"
data-gadget-url
"
)
&&
(
node
.
_gadget
!==
undefined
))
{
(
node
.
_gadget
!==
undefined
))
{
crea
teGadgetMonitor
(
node
.
_gadget
);
dele
teGadgetMonitor
(
node
.
_gadget
);
}
}
added_list
=
added_list
=
node
.
querySelectorAll
(
"
[data-gadget-url]
"
);
node
.
querySelectorAll
(
"
[data-gadget-url]
"
);
...
@@ -1503,7 +1506,7 @@
...
@@ -1503,7 +1506,7 @@
for
(
k
=
0
;
k
<
len2
;
k
+=
1
)
{
for
(
k
=
0
;
k
<
len2
;
k
+=
1
)
{
node
=
added_list
[
k
];
node
=
added_list
[
k
];
if
(
node
.
_gadget
!==
undefined
)
{
if
(
node
.
_gadget
!==
undefined
)
{
crea
teGadgetMonitor
(
node
.
_gadget
);
dele
teGadgetMonitor
(
node
.
_gadget
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
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