module rerun

Posted in General by Marcin Wed Jun 03 2015 09:14:21 GMT+0000 (UTC)·8·Viewed 1,995 times

I'm switching to the old latest ocLazyLoad, its absolutely awesome apart form one thing. There used to be a flag: 'rerun' which used to execute run block upon module reload. My project depends on it quite a lot, has this been removed in latest version? because it no longer works
Olivier Combe
June 3, 2015

It should still work, could you open up an issue on github with a use case please? https://github.com/ocombe/ocLazyLoad/issues

Marcin
June 3, 2015

Hi,
First of all thank you for your support and excellent piece of code.
I am investigating the problem. Is there a way to prevent some modules from reloading and rerunning like skipModules: param or something ??

Olivier Combe
June 3, 2015

Well you can add the rerun param to only one module:

$ocLazyLoad.load([{
  rerun: true,
  files: ['testModule1.js']
}, {
  files: ['testModule2.js']
}]);
Marcin
June 3, 2015

The problem is more complex. I'am not loading this module using load function, instead this module is already loaded and its a dependency of the main module. When the app runs it re-registers all modules and reruns run block there. this causes all of the event handlers to duplicate. Basically it looks like I would like to add my module to regModules looking at the source code.

Olivier Combe
June 3, 2015

So why do you want to execute run blocks again if you have problems with it ?
Also you might want to use the inject method if you don't need to load the files.
It will allow you to register modules (and eventually rerun) just by using their names

Marcin
June 3, 2015

I need to run blocks on the modules I'm loading to resolve some data dependencies before controller runs. This works perfect. I think the issue is that let say I'm loading a module A which has module B as dependecy (where B is already loaded) when A gets reloaded and rerun it also runs 'run' on B, despite the fact only A is reloaded. This causes my headache :]

Olivier Combe
June 3, 2015

Yeah that's not really possible right now...
Maybe you could use some kind of global variable that would prevent some of those run blocks to be invoked more than once ?

Marcin
June 3, 2015

yea, this is what I'm doing. There used to be a skipModules config parameter on the provider on some old versions.
Thanks for your suport

  
Markdown is allowed