linb.MessageService is global, but I suggest the following solution:
var parentAPP=this;
linb.ComFactory.newCom('App.module1',
function(){
// You should set a reference in the sub module
// And you can call any funciton or fire any event of the 'App'
this.$parentAPP=parentAPP;
this.show(linb([document.body]));
}
);
On Saturday, March 16, 2013 3:34:47 PM UTC+8,
adp6...@gmail.com wrote:
Busy paying around with this library. So far I am very impressed. Seems like a lot!! of hours have gone into making it, and all documentation is fairly easy to follow.
I must add, I am very new to the whole JS / DOM development scene, so most is still very abstract, so if my question seems dumb, it probably is...
Anyway, to the question..
I have to classes, App and module1.
For example, App has a field and a button, module1 has only a button.
App is the startup module (App) created by index.html.
module1 is created when button on App is pressed, as follows:
linb.ComFactory.newCom('App.module1',
function(){
this.show(linb([document.body]));
});
The content of module1 is a linb.UI.dialog, containing one button...
This all works ok, once button on 'App' is pressed, the dialog pops up and I have the button.
(Followed the Example 'Distributed UI')
What I want to do now is that when module1.button is pressed, I somehow fire an event in 'App' or send it a message to set the field on it.
I have tried many methods, none which seems to work.
1.
Using linb.MessageService, which seemed like a perfect mechanism to pass messages between instances of linb.Com, but I could not get a global MessageService object instantiated. (Lack of know-how)
2.
linb.SC seemed like a candidate, but the returned object ('App') does not seem to be the parent/root object and calling a function in it does nothing.
3.
Update DOM object directly to try an coax an even trigger on change also seemed to fail.
I am sure all of these method have some way of working, but what is the LINB way ?
Thanks