Skip to content

Conversation

@logsol
Copy link
Owner

@logsol logsol commented Oct 11, 2016

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

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
@logsol
Copy link
Owner Author

logsol commented Oct 11, 2016

@jeena I thought that we could try Github Flow for non-pair-programmed code. What do you think?

@jeena
Copy link
Collaborator

jeena commented Oct 12, 2016

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 || {};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever expect App to be pre-populated? When?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@logsol
Copy link
Owner Author

logsol commented Oct 13, 2016

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants