Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
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 @@
RenderJSGadget
.
prototype
.
__required_css_list
=
[];
RenderJSGadget
.
prototype
.
__required_js_list
=
[];
function
deleteGadgetMonitor
(
g
)
{
g
.
__monitor
.
cancel
();
delete
g
.
__monitor
;
g
.
__job_list
=
[];
}
function
createGadgetMonitor
(
g
)
{
if
(
g
.
__monitor
!==
undefined
)
{
g
.
__monitor
.
cancel
();
}
g
.
__monitor
=
new
Monitor
();
g
.
__job_dict
=
{};
g
.
__job_list
=
[];
g
.
__job_triggered
=
false
;
g
.
__monitor
.
fail
(
function
handleGadgetMonitorError
(
error
)
{
if
(
!
(
error
instanceof
RSVP
.
CancellationError
))
{
...
...
@@ -465,10 +467,10 @@
function
clearGadgetInternalParameters
(
gadget
)
{
gadget
.
__sub_gadget_dict
=
{};
gadget
.
__job_list
=
[];
if
(
gadget
.
__json_state
!==
undefined
)
{
gadget
.
state
=
JSON
.
parse
(
gadget
.
__json_state
);
}
createGadgetMonitor
(
gadget
);
}
function
loadSubGadgetDOMDeclaration
()
{
...
...
@@ -586,6 +588,7 @@
}
function
startService
(
gadget
)
{
createGadgetMonitor
(
gadget
);
gadget
.
__monitor
.
monitor
(
new
RSVP
.
Queue
()
.
push
(
function
monitorAllServiceList
()
{
var
i
,
...
...
@@ -1495,7 +1498,7 @@
if
(
node
.
nodeType
===
Node
.
ELEMENT_NODE
)
{
if
(
node
.
hasAttribute
(
"
data-gadget-url
"
)
&&
(
node
.
_gadget
!==
undefined
))
{
crea
teGadgetMonitor
(
node
.
_gadget
);
dele
teGadgetMonitor
(
node
.
_gadget
);
}
added_list
=
node
.
querySelectorAll
(
"
[data-gadget-url]
"
);
...
...
@@ -1503,7 +1506,7 @@
for
(
k
=
0
;
k
<
len2
;
k
+=
1
)
{
node
=
added_list
[
k
];
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