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
83d1db17
Commit
83d1db17
authored
Sep 04, 2017
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
onLoop: call the callback function with the gadget as 'this'
parent
a5273d87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
renderjs.js
renderjs.js
+2
-1
test/renderjs_test.js
test/renderjs_test.js
+6
-1
No files found.
renderjs.js
View file @
83d1db17
...
...
@@ -512,6 +512,7 @@
}
this
.
__service_list
.
push
(
function
()
{
var
queue_loop
=
new
RSVP
.
Queue
(),
context
=
this
,
wait
=
function
()
{
queue_loop
.
push
(
function
()
{
...
...
@@ -522,7 +523,7 @@
return
promiseAnimationFrame
();
})
.
push
(
function
()
{
return
callback
.
apply
(
this
,
[]);
return
callback
.
apply
(
context
,
[]);
})
.
push
(
function
()
{
wait
();
...
...
test/renderjs_test.js
View file @
83d1db17
...
...
@@ -2807,6 +2807,7 @@
klass
.
onLoop
(
function
(
evt
)
{
service_status
.
start_count
+=
1
;
service_status
.
this
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
service_status
.
status
=
"
started
"
;
...
...
@@ -2823,6 +2824,7 @@
test
(
'
callback is triggered on timeout
'
,
function
()
{
var
service1
=
{},
gadget
=
new
RenderJSGadget
(),
sub_gadget
,
html_url
=
'
https://example.org/files/qunittest/test599.html
'
;
gadget
.
__sub_gadget_dict
=
{};
...
...
@@ -2832,7 +2834,7 @@
document
.
getElementById
(
'
qunit-fixture
'
).
innerHTML
=
"
<div></div>
"
;
stop
();
expect
(
9
);
expect
(
11
);
renderJS
.
declareGadgetKlass
(
html_url
)
.
then
(
function
(
Klass
)
{
declareTimeoutToCheck
(
Klass
,
service1
);
...
...
@@ -2843,12 +2845,14 @@
);
})
.
then
(
function
(
g
)
{
sub_gadget
=
g
;
return
RSVP
.
delay
(
50
);
})
.
then
(
function
()
{
equal
(
service1
.
start_count
,
1
);
equal
(
service1
.
stop_count
,
0
);
equal
(
service1
.
status
,
"
started
"
);
equal
(
service1
.
this
,
sub_gadget
);
service1
.
defer
.
resolve
();
return
RSVP
.
delay
(
50
);
})
...
...
@@ -2856,6 +2860,7 @@
equal
(
service1
.
start_count
,
2
);
equal
(
service1
.
stop_count
,
1
);
equal
(
service1
.
status
,
"
started
"
);
equal
(
service1
.
this
,
sub_gadget
);
return
RSVP
.
delay
(
50
);
})
.
then
(
function
()
{
...
...
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