-
Notifications
You must be signed in to change notification settings - Fork 11
Asychronous and or Synchronous methods
EntitySpaces edited this page Jan 22, 2012
·
1 revision
//----------------------------------------------------------
// Here is a code snippet using the synchronous approach
//----------------------------------------------------------
var emp = new es.objects.Employees();
emp.loadByPrimaryKey(2);
emp.FirstName("sync" + "!!!");
emp.save();
var coll = new es.objects.EmployeesCollection();
coll.loadAll();
coll()[0].FirstName("Rocks!!");
coll.save();
//-----------------------------------------------------------------
// Here is the same code from above using the asynchronous approach
//-----------------------------------------------------------------
var emp = new es.objects.Employees();
emp.loadByPrimaryKey(2, function (data) {
emp.FirstName("sync" + "!!!");
emp.save(function (data) {
var coll = new es.objects.EmployeesCollection();
coll.loadAll(function (data) {
coll()[0].FirstName("Rocks!!");
coll.save(function (data) {
var str = "Save is complete ...";
});
});
});
});