javascript - document scopes with JSDOC -
i`m having difficult times documents scopes jsdoc, can tell right way document following code :
(right now, jsdoc generates methods in global functions , should belong workareaplugin )
/** * @namespaces retalix.storeofficeclient.web.scripts.general.workarea * @scope workareaplugin */ (function ($, undefined) { /** * description * @constructor * @method ctor * @param {} options * @return */ var ctor = function (options) { var self = this; var _data; var _new; var _grids = {}; if (this.setupajaxcrud) { this.setupajaxcrud(); } $.extend(self, { /** * sets data property of current scope , setups set_isdirty , get_isdirty functions if not exist data object * @method set_data * @param {} data * @param {} triggerchange * @return */ set_data: function (data, triggerchange) { _data = data || {}; if (!_data.set_isdirty) { $.setupdirtyfunctions(_data); } if (triggerchange !== false) { self.trigger("datachanged", [_data, self]); } } }); this.bind("login", function () { var isdirty = self.isdirty(); if (!isdirty && self.loader && $.isfunction(self.loader.doloading)) { self.reload(); } }); }; storeofficeclient.plugins.register("workarea", undefined, undefined, ctor); })(jquery);
let me preface pointing out documenting javascript code jsdoc boils down matter of convention , how want present relationship between js entities people reading documentation. following one possible answer.
the following put in single namespace:
/** * @namespace retalix.storeofficeclient.web.scripts.general.workarea.workareaplugin * */ (/** @lends retalix.storeofficeclient.web.scripts.general.workarea.workareaplugin */ function ($, undefined) { /** * description * @constructor * @param {} options */ var ctor = function (options) { var self = this; var _data; var _new; var _grids = {}; if (this.setupajaxcrud) { this.setupajaxcrud(); } $.extend(self, /** @lends retalix.storeofficeclient.web.scripts.general.workarea.workareaplugin~ctor# */ { /** * sets data property of current scope , setups set_isdirty , get_isdirty functions if not exist data object * @param {} data * @param {} triggerchange */ set_data: function (data, triggerchange) { _data = data || {}; if (!_data.set_isdirty) { $.setupdirtyfunctions(_data); } if (triggerchange !== false) { self.trigger("datachanged", [_data, self]); } } }); this.bind("login", function () { var isdirty = self.isdirty(); if (!isdirty && self.loader && $.isfunction(self.loader.doloading)) { self.reload(); } }); }; storeofficeclient.plugins.register("workarea", undefined, undefined, ctor); })(jquery);
Comments
Post a Comment