Many users have been asking to be able to make sure that they can not only have multi-apps in the same page loaded separately (which was a 1.1 feature), but also to allow a simple 'namespace' mechanism to assure that multiple apps dont collide when accessing application managed objects, for example
PROBLEM - What happens if multiple apps have application managed objects with the same id?
//App1:(loaded first)
$.$('#tableView');
//App2:(loaded second)
$.$('#tableView')
In 1.1 and earlier the result was ambiguous from a design perspective, you just were supposed to make sure you used unique ids across all apps in a page. In 1.2 we wanted to make this behavior unambiguous, especially because its an important part of being able to enable the lazy loading of scripts.
In the case where multiple apps have no namespace - first come, first serve. In this case App1 will win since claypool will not overwrite an app id that has already been reserved.
//App1:(loaded first)
$.$('#tableView');
//App2:(loaded second)
$.$('#tableView')
Now if you know your app is built to run as a mini-app among many other apps, you can now design for that by using namespaces!
App1:(loaded first )
//this type of scanner is new and simplifies application registration.
//apps that use it have no namespace
$.scan( 'MyAppLiteral1');
App2:(loaded second)
//this type of scanner is new and simplifies application registration.
//apps that use it have do have a namespace
$.scan({ a: 'MyAppLiteral2' });
In this case there is no ambiguity in the following:
$.$('#tableView');//App1
$.$('a#tableView');//App2
Thoughts?
--
Christopher Thatcher