Last active
January 3, 2016 18:19
-
-
Save consideRatio/8501846 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Performance question | |
A lot of databinding is in place, coupled with the model of the controller. | |
I wanna make more then one change and then let the visual changes to the | |
databinding happen, not step by step. | |
Question 1: Will UI-databinding trigger step-by-step when making | |
changes within setupController? | |
Question 2: If so, is there a way to suspend such step-by-step | |
changes, and make them add up until you resume? (Version 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Version 1 | |
setupController: function( controller, model ) { | |
var manager = controller.get('manager'); | |
controller.set('model', model); // Will databinding for UI evaluate here before manager.reset()? | |
if (manager) | |
manager.reset(); | |
else | |
controller.set('manager', App.WorkManager.create()); | |
}, | |
// Version 2 | |
setupController: function( controller, model ) { | |
var manager = controller.get('manager'); | |
if (manager) | |
manager.reset(); | |
controller.set('model', model); // If databinding evaluates directly I'd prefere this | |
if (!manager) | |
controller.set('manager', App.WorkManager.create()); | |
}, | |
// Version 3 | |
setupController: function( controller, model ) { | |
var manager = controller.get('manager'); | |
// Best solution would be - Part 1 | |
// ????.suspendRendering(); | |
controller.set('model', model); | |
if (manager) | |
manager.reset(); | |
else | |
controller.set('manager', App.WorkManager.create()); | |
// Best solution would be - Part 2 | |
// ????.resumeRendering(); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment