Created
February 9, 2012 17:48
-
-
Save trodrigues/1781533 to your computer and use it in GitHub Desktop.
references inside references
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // should this.modules.module1 work? | |
| define({ | |
| appStructure: { | |
| literal: { | |
| module1: { $ref: 'module1' }, | |
| module2: { $ref: 'module2' } | |
| } | |
| }, | |
| module1: { | |
| create: { | |
| module: 'module1' | |
| }, | |
| properties: { modules: {$ref: 'appStructure'} } | |
| }, | |
| module2: { | |
| create: { | |
| module: 'module2' | |
| }, | |
| properties: { modules: {$ref: 'appStructure'} } | |
| } | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh, I see. The wire! reference resolver injected into the module is something I hadn't noticed before (maybe it could be better highlighted in the docs?) and it actually makes a lot more sense than always having to require the spec. And, having the spec cached is something I don't mind, and I actually expected it to work like that.
I was actually looking at contexts right now, as I have a possible use case for them. This app was organized under a global namespace with sub namespaces under it, and there's wasn't much thought of having a very organized interaction between modules, so there's things like submodules setting values on higher level namespaces. At times I struggle a bit figuring out the best way to do some things with this new workflow.
I'll try to show you guys some stuff when I get it working properly, but it still won't be pretty. Basically, turning the existing modules into AMD modules and using wire.js where it makes sense is the first step to the restructuring of this app. There's a lot of logic in views and other issues that will require some reorganization and splitting up of things and I thought it would be better to first get these tools in place before starting to do that sort of work.
Also, there's a few quirks regarding the way the app is bootstrapped and deployed (this is a Spotify App by the way!) that make it a bit different than most browser based single page apps.