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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
renderjs
Commits
95726c33
Commit
95726c33
authored
Feb 24, 2017
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent calling onStateChange callback if not needed
parent
32a5a8ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
renderjs.js
renderjs.js
+1
-1
test/renderjs_test.js
test/renderjs_test.js
+24
-0
No files found.
renderjs.js
View file @
95726c33
...
...
@@ -608,7 +608,6 @@
modified
=
true
;
}
else
{
modification_dict
=
{};
this
.
__modification_dict
=
modification_dict
;
}
for
(
key
in
state_dict
)
{
if
(
state_dict
.
hasOwnProperty
(
key
)
&&
...
...
@@ -619,6 +618,7 @@
}
}
if
(
modified
&&
this
.
__state_change_callback
!==
undefined
)
{
this
.
__modification_dict
=
modification_dict
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
context
.
__state_change_callback
(
modification_dict
);
...
...
test/renderjs_test.js
View file @
95726c33
...
...
@@ -1328,6 +1328,30 @@
});
});
test
(
'
do not trigger onStateChange if no changed keys twice
'
,
function
()
{
var
gadget
=
new
RenderJSGadget
(),
callback_called
=
false
;
gadget
.
state
=
{};
gadget
.
__state_change_callback
=
function
()
{
callback_called
=
true
;
};
stop
();
gadget
.
changeState
({})
.
then
(
function
()
{
ok
(
!
callback_called
);
return
gadget
.
changeState
({});
})
.
then
(
function
()
{
ok
(
!
callback_called
);
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
test
(
'
accumulate modification_dict on onStateChange error
'
,
function
()
{
var
gadget
=
new
RenderJSGadget
();
expect
(
13
);
...
...
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