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

Allow defining multiple @method in a single block #364

Open
danShumway opened this issue Jul 2, 2015 · 2 comments
Open

Allow defining multiple @method in a single block #364

danShumway opened this issue Jul 2, 2015 · 2 comments

Comments

@danShumway
Copy link

Would be useful for shorthanding some method creations. For example:

/**
* Wrapper for relevant model method
* @param myMethodParam
* @method method1
* @method method2
* @method method3
* @method method4
*/
var that = this;
_.each(['method1', 'method2', 'method3', 'method4'], function(method) {
      //Provide wrappers for methods on the model that the view wants direct references to.
      Controller.prototype[method] = function() {
          return that.model[method].apply(that._model, arguments);
     }
 });

Would be equivalent to

/**
* Wrapper for relevant model method
* @param myMethodParam
* @method method1
*/
/**
* Wrapper for relevant model method
* @param myMethodParam
* @method method2
*/
/**
* Wrapper for relevant model method
* @param myMethodParam
* @method method3
*/
/**
* Wrapper for relevant model method
* @param myMethodParam
* @method method4
*/
var that = this;
_.each(['method1, method2, method3'], function(method) {
      //Provide wrappers for methods on the model that the view wants direct references to.
      Controller.prototype[method] = function() {
          return that.model[method].apply(that._model, arguments);
     }
 });

Even better would be allowing something like:

/**
* Wrapper for relevant model method
* @param myMethodParam
* @method method1, method2, method3, method4
*/
@okuryu
Copy link
Member

okuryu commented Aug 3, 2015

Patch welcome.

@danShumway
Copy link
Author

:) Fair enough, if I get time anytime soon I'll take a look at the source and try to write something up.

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

No branches or pull requests

2 participants