Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 minor additions #13

Merged
merged 5 commits into from
May 30, 2013
Merged

3 minor additions #13

merged 5 commits into from
May 30, 2013

Conversation

mtsr
Copy link
Contributor

@mtsr mtsr commented May 29, 2013

Hey,

I've made three minor additions I find very useful:

  • Make Context pass arguments from constructor to initialize() following backbone conventions
  • Allow bindContext() to also take an existing context instead of constructor
  • Automatically map commands in Context.commands property
    E.g.:
    commands: {
    'commandName': CommandConstructor
    }

I hope you find them useful. Best regards,

Jonas

@@ -35,7 +35,7 @@
this.vent = {};
_.extend(this.vent, Backbone.Events);
if (_.isFunction(this.initialize)) {
this.initialize();
this.initialize.apply(this, arguments);
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this idea in principle. Just curious if you have found a use case for it yet? Generally my Context objects have only served to map the commands. What sort of parameters are useful in the initialize() method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, since I like the idea of all models living in the context, I pass some models into the constructor.

@mtsr
Copy link
Contributor Author

mtsr commented May 30, 2013

Just noticed I lost this.mapCommands(); in the constructor while merging.

mtsr added 2 commits May 30, 2013 07:04
Note to self: don't add to pull requests while working on the train ;)
geekdave added a commit that referenced this pull request May 30, 2013
* Make Context pass arguments from constructor to initialize() following backbone conventions
* Allow bindContext() to also take an existing context instead of constructor
* Automatically map commands in Context.commands property E.g.: commands: { 'commandName': CommandConstructor }
@geekdave geekdave merged commit 797da98 into GeppettoJS:master May 30, 2013
@geekdave
Copy link
Contributor

Thanks for the contributions and the great discussion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants