sustainableis / javascript-framework

0 stars 0 forks source link

Alternative ways for inter-module communication #9

Open morion4000 opened 9 years ago

morion4000 commented 9 years ago

After having a chat with @windmaomao, we agreed that we can/should implement different ways of exchanging data between modules and between modules and the apps.

morion4000 commented 9 years ago

sisModules.init allows sending options as the second parameter. If the scope property is provided then the modules are going to use it, if not, a new isolated scope on $rootScope is going to be used.

eg:

sisModules.init(function() {}, {scope: $scope});
windmaomao commented 9 years ago

Thank you very much for the effort, for now, if we can mention in the current documentation that one of the possible way to send data in and out of module is using

events.publish('facility-user', data);

and

events.subscribe('facility-user', function(data) {});

that'll be great. The above publish and subscribe works both in main app controller and modules.