Refactores the GLOBALS.context to use more expressive naming#172
Refactores the GLOBALS.context to use more expressive naming#172
Conversation
Combines GLOBALS and Chuck namespace into App. Also increases number of stack trace steps to be printed when an error occurs. I experimented with the "replace" plugin from require.js, which works but it would mean that our context switchable "import-statements" would look like the example below, which I decided against at least for now, just because of the looks. The downside of not using the plugin is that we cannot use the "use strict" statement in the channel.js entry script and also cannot put a "var" in front of App variable there. For example: "replace!Game/:AppContext/Physics/Engine", Instead of: "Game/" + App.context + "/Physics/Engine", Fixes #86
|
@jeena I thought that we could try Github Flow for non-pair-programmed code. What do you think? |
|
The main question would be if this would help us to avoid errors by telling us on startup time or something that we have misspelled something instead of during runtime, that would be a good advantage. |
|
|
||
| if(!Chuck) var Chuck = {}; | ||
| Chuck.inspector = {}; | ||
| var App = App || {}; |
There was a problem hiding this comment.
Do we ever expect App to be pre-populated? When?
There was a problem hiding this comment.
No, it was thought of as a kind of module extension pattern. But regarding my comment below it might make sense to actually get rid of this, provide the context as a require.js configuration and actually use the replace plugin.
|
No it will always resolve the whole tree in the beginning, so this is already given. The other advantage of using it would be that we didn't need a global variable anymore. We could then just expose it in dev environment for the inspector and keep it inside the scope in production. That reminds me why I chose the "Chuck" variable name - May be less likely to collide with some library than "App". |
Combines GLOBALS and Chuck namespace into App. Also increases
number of stack trace steps to be printed when an error occurs.
I experimented with the "replace" plugin from require.js, which
works but it would mean that our context switchable
"import-statements" would look like the example below, which I
decided against at least for now, just because of the looks.
The downside of not using the plugin is that we cannot use the
"use strict" statement in the channel.js entry script and also
cannot put a "var" in front of App variable there.
For example: "replace!Game/:AppContext/Physics/Engine",
Instead of: "Game/" + App.context + "/Physics/Engine",
Fixes #86