Open ItsAsbreuk opened 11 years ago
Marco,
I know Bill is working in the direction you're suggesting with his work on integrating YAF in the client. He can provide more detailed input.
ss
On Dec 9, 2012, at 2:14, "Marco Asbreuk" notifications@github.com<mailto:notifications@github.com> wrote:
I wanted this to be a pull-request, but I can only post issues...
Can't we use Y.EventTarget instead of the suggested interMojit-communication? The first is such a great infrastructure of and familiair by YUI-developers.
Besides that, I think there are some more reassons why broadcasting through a masterMojit by code doesn't seem the right way (from my point of view):
1) When you setup the broadcasted event at the masterMojit, you assume the targetid of the receiverMojit is available. However, when the receiverMojit gets a refreshView(), its Id will change.
2) You want Mojits to act as singleton modules (mojits). So, you should be able to distribute them and integrate them without having to change the code elsewhere (except for application.json). But using this structure, you always need to modify code of a masterMojit in order to succeed communication to your receiverMojit
3) I like the mojitStructure and I'm developing an app with quite a lot child-mojits. I find myself writing a bunch of code within the masterMojit just for making communication possible. Because I'm struggling with childMojits that might not yet exist (issue #847https://github.com/yahoo/mojito/issues/847), I'm writing it this way:
instance.mojitProxy.listen('statusChange', Y.bind(function(payload) {
var instance = this,
mojitChildren = instance.mojitProxy.getChildren(),
receiverID = mojitChildren["footer"];
if (receiverID) {
mojitProxy.broadcast('broadcast-statusChange', {message: payload.data.message}, { target: {viewId:receiverID.viewId }});
}
else {
Y.ItsaDialogBox.showErrorMessage('Internal error', 'mojitChild \'footer\' does not exists.');
}
}, instance));
So, with many childMojits, the code becomes huge.
I think I could use Y.EventTarget right out of the hood, but I want to programm the suggested Mojito-way. What your oppinion in this?
Marco.
— Reply to this email directly or view it on GitHubhttps://github.com/yahoo/mojito/issues/848.
I wanted this to be a pull-request, but I can only post issues...
Can't we use Y.EventTarget instead of the suggested interMojit-communication? The first is such a great infrastructure and familiair by YUI-developers.
Besides that, I think there are some more reassons why broadcasting through a masterMojit by code doesn't seem the right way (from my point of view):
1) When you setup the broadcasted event at the masterMojit, you assume the targetid of the receiverMojit is available. However, when the receiverMojit gets a refreshView(), its Id will change.
2) You want Mojits to act as singleton, sharable units (mojits). So, you should be able to distribute them and integrate them without having to change the code elsewhere (except for application.json). But using this structure, you always need to modify code of a masterMojit in order to succeed communication to your receiverMojit
3) I like Mojits and I'm developing an app with quite a lot child-mojits. I find myself writing a bunch of code within the masterMojit just for making communication possible. Because I'm struggling with childMojits that might not yet exist (issue #847), I'm writing it this way:
So, with many childMojits, the code becomes huge.
I think I could use Y.EventTarget right out of the box, but I want to programm the suggested Mojito-way. What your oppinion in this?
Marco.