bessemHmidi / AngularBeans

http://bessemhmidi.github.io/AngularBeans
GNU Lesser General Public License v3.0
250 stars 90 forks source link

Implemented factory around StaticJsCache. #41

Closed anaili closed 8 years ago

anaili commented 8 years ago

Created a factory pattern for static javascript cache generation with some code cleanup and optimization.

anaili commented 8 years ago

@yesbutno you might be concerned by this PR. As you worked on StaticJsCache.

yesbutno commented 8 years ago

I'm not sure I completely understand how this works and would really appreciate some help to figure things out:

Sorry for the lot of questions, but maybe you could help me out.

anaili commented 8 years ago

No problem, feel free to ask any questions !

yesbutno commented 8 years ago

Thanks! And now me again ;-)

anaili commented 8 years ago

Actually, getAppName() returns the ngApp attribute's value which is mandatory in script generation because it has to be injected in 'app' module. The question now is, why we don't let the user implement the @NGApp annotated class ? Maybe @bessemHmidi has an explanation for this. About BuildStaticJsCache, I'm working on a different way to instantiate the StaticJsCacheLoader.

yesbutno commented 8 years ago

Oh dear. I see there's still one thing or two I can learn about the actual meaning of the codebase ;-) I only saw @Named being the only annotation that is handled in getAppName() and no access to any parts of this static js cache, and the name actually coming from the BeanRegistry...

bessemHmidi commented 8 years ago

i will explain anout @NGApp:

i wanted in the begining to let the user declare his app (or apps), and if not provided angularBean will provide a default one.

but after that i remarqued that with the multiple apps we need a mapping or a grouping of the different angularBeans to their app, for example something like @AngularBean(appName='app1')

and in the js side providing different js import : script src='angular-beans-core'> script src='app1.js'> script src='app2.js'>

all that need a small study to be efficient and even i thinked about AMD or asynchronous js loading, that is important for a big application. but Angular2 provide a built in dependency mecanisme so, i preferred to move the effort to that version.

Hope that was clear :)

bessemHmidi commented 8 years ago

@yesbutno completely undrestandable :) and sorry for the lack of code comments.