srfsh# request open-ils.pcrud open-ils.pcrud.retrieve.aou "ANONYMOUS", 1
---------------------------------------------------------------------------
+== PCRUD JavaScript Interface (pre-browser client)
+
+[source,js]
+---------------------------------------------------------------------------
+var pcrud = new openils.PermaCrud();
+
+pcrud.retrieve('aou', 1, {oncomplete : function(org) { ... }});
+pcrud.update(some_org, {oncomplete : function(resp) { ... }});
+
+pcrud.search('aou', {parent_ou : 1}, {
+ oncomplete : function(r) {
+ var orgs = openils.Util.readResponse(r);
+ console.log('org units: ' + orgs);
+ }
+});
+
+---------------------------------------------------------------------------
+
+== PCRUD JavaScript Interface (browser client)
+
+ * Uses promises
+ * Defaults to streaming searches
+
+[source,js]
+---------------------------------------------------------------------------
+egCore.pcrud.retrieve('aou', 1).then(function(org) { ... });
+egCore.pcrud.update(some_org).then(function(resp) { ... });
+
+egCore.pcrud.search('aou', {parent_ou : 1})
+.then(
+ function() {...}, // oncomplete
+ function() {...}, // onerror
+ function(one_org) { // onresponse
+ console.log('one org unit: ' + one_org);
+ }
+});
+---------------------------------------------------------------------------
+
== When Not To Use PCRUD
* PCRUD is powerful enough to implement most logic in the client, but
---------------------------------------------------------------------------
+
== Questions / Comments
* Slides