My work on Encapsule Project Schema (a single-page HTML 5 app that wants to be a CAD program someday) has evolved over the course of this year’s hacking efforts to become a little test harness around a new library I call ONMjs.
STABLE LINK: http://www.chrisrussell.net/html5/schema-13-ONMjs/schema.html#/ (archived snapshot of the app as of this afternoon).
Here’s a little bit about ONMjs:
ONMjs manages data on behalf of your web application, brokers communication between your application’s subsystems, and provides an architectural framework based the principles of Separation of Concerns, Signal Programming, and Component-Based Software Engineering that makes it easy to build elegantly modular, inherently decoupled applications.
With that little background, now go look at the Encapsule Project Schema app and realize that the only only non-generic part of the entire app is a declaration of the application’s data model. Huh?
In this example the data model defines an extensible “object model” for Encapsule Project’s Soft Circuit Description Language (SCDL) (the declaration is a Javscript object). This “model” is fed to ONMjs which manages all the runtime data of the app. All the visual elements in the Schema app are currently “observer” plug-ins; they react to changes and leverage meta-data from the model, and data from ONMjs to update the DOM.
This means that you can trivially change the Schema app into a custom editor for whatever type of data you want simply by initializing it with a different model for the data.
I’m working on the docs and getting the code split out of Schema this week for publication of a preview on GitHub. Please follow @Encapsule on Twitter for updates if this subject interests you. Thanks!