Last active
October 7, 2015 09:27
-
-
Save dbaba/3143092 to your computer and use it in GitHub Desktop.
ModelMapper.updateField() from MOAT js API Document
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
// Get the UID | |
var uid = ....; | |
// Prepares an update operation. | |
var myArrayTypeMapper = | |
session.newModelMapperStub('MyArrayType'); | |
// Creates or retrieves a model object | |
var obj = ...; | |
obj.myProperty = 'myValue'; | |
obj.myIntProperty = 12345; | |
obj.myBooleanProperty = true; | |
// Enqueues the update operation | |
myArrayTypeMapper.updateFields(obj, | |
// Specifies 2 of 3 props to be updated | |
['myProperty', 'myIntProperty'], { | |
error : function(type, code) { | |
if (type == 'NOT_FOUND') { | |
// Create new! | |
myArrayTypeMapper.add(obj); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment