I use the relatively immature Joose Javascript ORM plugin ( project page ) to save objects in the Appcelerator Titanium ( company page ) mobile project. Since this is client-side storage, the application must check if the database is initialized before running ORM, as it checks the database tables to create classes.
My problem is that this sequence of operations (and if so, other things along the way) requires a lot of callbacks to complete. I jump a lot in the code, which is not obvious to the maintainer, and leads to some complicated call schedules and something else. Therefore, I ask the following questions:
- How would you asynchronously initialize a database and populate it with seed using ORM, for the schema to work correctly?
- Do you have any general strategies or links for asynchronous / event-driven programming, and keep the call graph simple and straightforward?
- Do you have any suggestions for Javascript ORMs / metaobject systems that work with HTML 5 as a data storage mechanism and hopefully are agnostics?
- Am I just a big newbie and should be able to handle this with ease?
Thanks guys!
source share