Skip to content

Instantly share code, notes, and snippets.

@johnpapa
Created August 13, 2012 17:40
Show Gist options
  • Save johnpapa/3342697 to your computer and use it in GitHub Desktop.
Save johnpapa/3342697 to your computer and use it in GitHub Desktop.
async command issues
saveCmd = ko.asyncCommand({
execute: function (complete) {
if (canEditSession()) {
setTimeout(function() {
$.when(datacontext.sessions.updateData(session()))
.always(complete);
}, 3000);
return;
}
if (canEditEval()) {
$.when(datacontext.attendance.updateData(session()))
.always(complete);
return;
}
},
canExecute: function (isExecuting) {
return isDirty() && isValid;
}
}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment