Skip to content

Instantly share code, notes, and snippets.

Created May 20, 2010 16:37
Show Gist options
  • Save anonymous/407778 to your computer and use it in GitHub Desktop.
Save anonymous/407778 to your computer and use it in GitHub Desktop.
selection changed
projectTreeController.js:37timer destroyed
projectTreeController.js:47timer created
projectTreeController.js:33selection changed
projectTreeController.js:37timer destroyed
projectTreeController.js:47timer created
projectTreeController.js:54I was called by the timer
projectTreeController.js:125timer destroyed in get selection data
projectTreeController.js:54I was called by the timer
projectTreeController.js:125timer destroyed in get selection data
javascript.js:19259XHR finished loading
javascript.js:19259XHR finished loading
///Data loads twice on initial load (as selection is set)
// then as we change our selection, everything fires, but no XHR requests ever go out
selection changed
projectTreeController.js:37timer destroyed
projectTreeController.js:47timer created
projectTreeController.js:54I was called by the timer
projectTreeController.js:125timer destroyed in get selection data
projectTreeController.js:33selection changed
projectTreeController.js:37timer destroyed
projectTreeController.js:47timer created
projectTreeController.js:54I was called by the timer
projectTreeController.js:125timer destroyed in get selection data
projectTreeController.js:33selection changed
projectTreeController.js:37timer destroyed
projectTreeController.js:47timer created
projectTreeController.js:54I was called by the timer
projectTreeController.js:125timer destroyed in get selection data
selectionDidChange: function()
{
console.log('selection changed');
if (this.changeTimer)
{
this.changeTimer.destroy();
console.log('timer destroyed');
}
this.changeTimer = SC.Timer.schedule({
target: this,
action: 'getSelectionData',
interval: 500,
until: Date.now() + 500
});
console.log('timer created');
}.observes('selection'),
getSelectionData: function()
{
console.log("I was called by the timer");
var IDs = [];
function getDigits(s){
return s.replace (/[^\d]/g, "");
}
//do lots of other stuff
//all in here
//Like make SC.Requests
//and notify other events when those requests finish
//
this.changeTimer.invalidate();
console.log('timer destroyed in get selection data');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment