Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ko.mapping.fromJS(newData, mapping, modelToUpdate)
- var mapping = {}; //define your mapping (see documentation or blog post)
- function ViewModel(){
- var self = this;
- self.model = ko.mapping.fromJS({}, mapping);
- self.hub = $.connection.myHub();
- self.hub.client.updateModel = function(data){
- ko.mapping.fromJS(data, mapping, self.model);
- };
- self.hub.start().done(function(){
- //you could either make a call or have the "OnConnected" method trigger an 'updateModel'
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement