Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by appMobiTony

This probably applies to other versions of Impact, but I am using 1.18a.

If you start Impact up in such a way that (document.readyState === 'complete') is true, you will fall into an error detection case and get the 'Unresolved (circular?) dependencies. ' error. This is because module() calls ig._initDOMReady(), which goes ahead with _execModules (because document.readyState is 'complete') and attempts to process the impact module. However, requires() and defines() have not yet run for the impact module, so you get into the error case as previously mentioned.

I fixed this issue by making the following changes in lib/impact/impact.js:
1. In module(), do no call ig._initDOMReady()
2. In defines(), replace the call to ig._execModules() with a call to ig._initDOMReady().

This allows the impact module's requires and defines to run before getting into _execModules() via _initDOMReady().

There aren't any undesired side effects that I noticed, but if there is something I am not aware of, please let me know.

1 decade ago by dominic

Oh wow, I think I actually saw that problem once or twice with Safari when loading from localhost, but I thought it was just a fluke. I'll be testing your solution, but at a first glimpse - I think should work.

Thank you so much for the info!

1 decade ago by appMobiTony

I found an undesired side effect.

With baked code, only the first module will get processed because after the first time, _initDOMReady will bail on:
		if( ig.modules['dom.ready'] ) { 
			return; 
		}

Therefore the following additional change is required in _initDOMReady:
		if( ig.modules['dom.ready'] ) { 
			ig._execModules();
			return; 
		}
Page 1 of 1
« first « previous next › last »