Skip to content

Instantly share code, notes, and snippets.

@andreabalducci
Created May 29, 2012 14:21
Show Gist options
  • Save andreabalducci/2828710 to your computer and use it in GitHub Desktop.
Save andreabalducci/2828710 to your computer and use it in GitHub Desktop.
winjs update context wrapper
// knockout mapping
UpdateContext.Execute(function(){
ko.applyBindings(viewmodel);
viewmodel.load();
});
(function (){
var UpdateContext = window.UpdateContext = window.UpdateContext || {};
var isWinJS = typeof(MSApp) != 'undefined';
if(isWinJS){
UpdateContext.Execute = function(cb){
MSApp.execUnsafeLocalFunction(cb);
};
}else{
UpdateContext.Execute = function(cb){
cb.call();
};
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment