jQuery.extendを使ってjsdoc用のコメントを書く
必要にせまられてjQuery.extendを使うことになった。けど単純にdocコメント埋めてもうまくオーバーライドメンバーのドキュメントを出力できない。
このように書く。
(function($){ /** * 親クラス * @class * @constructor */ var Parent = function(){}; Parent.prototype = { func1: function(){ }, func2:function(){ alert("parent"); } }; /** * 子クラス * @class * @constructor * @extends Parent */ var Child = function(){}; $.extend(Child.prototype,Parent.prototype,{ /** * オーバーライドメソッド * @function * @name Child.prototype.func2 */ func2:function(){ alert("child") } }); })(jQeury);
もしかしたら、バージョンによっては@memberOfとか@methodOfとかで出来るかもしれないけどうちの官位今日(2.4)では出来なかった。