http://sequelsphere.com). It is a simple API for accessing a local database with SQL. While nothing is needed to use it in jQuery, i would like to make it more jQuery-friendly.
In examining how to make a simple, synchronous database API useful in a jQuery environment, many options are available depending on the application architecture employed by the programmer. This begs the question, then, of whether there is sufficient agreement within the jQuery community on application architecture, or data access idioms, to encourage one over another.
My choices are:
- one option is to provide a plugin that mimics the .ajax plugin. For example, $().query(sql, settings) where settings would contain a "complete" callback function to execute when the query was done.
- a second option is to provide a plugin that triggers a custom event when the query was done. For example, $().query(sql, "empls-refreshed"). Any control that was sensitive to the query results could establish a handler and refresh itself when the query was complete.
- a third option is have no plugin, but programmers could establish a handler to a custom event that both queried and populated the control. The programmer would start the process by triggering the event.
I know which I favor, but I am curious what other, more experienced, jQuery developers think, both of the options and of other data access idioms that might be more effective.
Thanks in advance.