To use client-side web memory, 2 conditions must be met:
the webappos.js script has to be included;
webappos.init_web_memory has to be called (this is usually done inside webappos.<request_scopes>("webappos_scopes", "project_id"))
After that, the JavaScript tda.model object becomes available. Web memory is accessed through this object.
tda.model[r] is a repository element ( |
| ) with the given reference represented as a JavaScript object |
For each repository element (an object, an association end, an attribute, or a class) a client-side JavaScript object is created. If the element has a reference r in the repository, it can be accessed by index r in tda.model as tda.model[r].
For each class from the model repository of the given webAppOS project, a tda.model.ClassName constructor is created. The constructor creates a new repository object of the given class, registers it at the client side, and synchronizes it with the server.
Each class (tda.model.ClassName) has the following properties:
Each object (tda.model[r]) has the following properties:
There are also internal functions used when synced repository actions are received from the server. These actions correspond to Repository Access API (RAAPI), (see http://webappos.org/dev/raapi).
tda.model.createClass(className, r)
tda.model.createAttributeSetterGetter(obj, name, rAttr)
tda.model.deleteAttributeSetterGetter(obj, name)
tda.model.createAttribute(rClass, name, rType, r)
tda.model.setAttributeValue(rObj, rAttr, val)
tda.model.createAssociationSetterGetter(obj, roleName, rAssoc)
tda.model.deleteAssociationSetterGetter(obj, roleName)
tda.model.createAssociation(rSourceClass, rTargetClass, sourceRoleName, targetRoleName, isComposition, r1, r2)
tda.model.createObject(rClass, r)
...
In addition, there is also the tda.model.checkReference function used to register and create new client-side references.
var obj = new tda.model.ClassName();
obj.setAttributeName(5);
obj.getAttributeName();
obj.linkRoleName(obj2);
obj.unlinkRoleName(obj2);
var map = tda.model.<ClassName>.getAllObjects();
...