Add @constructor to all Function classes

Change-Id: I67b90a91b57fbd66363551eafe0cdfc14d5f68e8
This commit is contained in:
Tao Zhou
2020-01-09 14:51:25 +01:00
parent a1976465f0
commit 6226dd44c6
24 changed files with 33 additions and 5 deletions

View File

@@ -23,11 +23,11 @@
* Construct a change comments object, which can be data-bound to child
* elements of that which uses the gr-comment-api.
*
* @constructor
* @param {!Object} comments
* @param {!Object} robotComments
* @param {!Object} drafts
* @param {number} changeNum
* @constructor
*/
function ChangeComments(comments, robotComments, drafts, changeNum) {
this._comments = comments;

View File

@@ -20,6 +20,7 @@
// Prevent redefinition.
if (window.GrDiffBuilderBinary) { return; }
/** @constructor */
function GrDiffBuilderBinary(diff, prefs, outputEl) {
GrDiffBuilder.call(this, diff, prefs, outputEl);
}

View File

@@ -24,6 +24,7 @@
// arbitrary JavaScript.
const IMAGE_MIME_PATTERN = /^image\/(bmp|gif|x-icon|jpeg|jpg|png|tiff|webp)$/;
/** @constructor */
function GrDiffBuilderImage(diff, prefs, outputEl, baseImage, revisionImage) {
GrDiffBuilderSideBySide.call(this, diff, prefs, outputEl, []);
this._baseImage = baseImage;

View File

@@ -20,6 +20,7 @@
// Prevent redefinition.
if (window.GrDiffBuilderSideBySide) { return; }
/** @constructor */
function GrDiffBuilderSideBySide(diff, prefs, outputEl, layers) {
GrDiffBuilder.call(this, diff, prefs, outputEl, layers);
}

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(window, GrDiffLine) {
(function(window) {
'use strict';
// Prevent redefinition.
@@ -23,6 +23,7 @@
/**
* A chunk of the diff that should be rendered together.
*
* @constructor
* @param {!GrDiffGroup.Type} type
* @param {!Array<!GrDiffLine>=} opt_lines
*/
@@ -285,4 +286,4 @@
};
window.GrDiffGroup = GrDiffGroup;
})(window, GrDiffLine);
})(window);

View File

@@ -21,6 +21,7 @@
if (window.GrDiffLine) { return; }
/**
* @constructor
* @param {GrDiffLine.Type} type
* @param {number|string=} opt_beforeLine
* @param {number|string=} opt_afterLine
@@ -46,6 +47,7 @@
this.text = '';
}
/** @enum {string} */
GrDiffLine.Type = {
ADD: 'add',
BOTH: 'both',

View File

@@ -20,6 +20,7 @@
// Prevent redefinition.
if (window.GrAdminApi) { return; }
/** @constructor */
function GrAdminApi(plugin) {
this.plugin = plugin;
plugin.on('admin-menu-links', this);

View File

@@ -17,6 +17,7 @@
(function(window) {
'use strict';
/** @constructor */
function GrAttributeHelper(element) {
this.element = element;
this._promises = {};

View File

@@ -17,6 +17,7 @@
(function(window) {
'use strict';
/** @constructor */
function GrChangeMetadataApi(plugin) {
this._hook = null;
this.plugin = plugin;

View File

@@ -17,6 +17,7 @@
(function(window) {
'use strict';
/** @constructor */
function GrDomHooksManager(plugin) {
this._plugin = plugin;
this._hooks = {};

View File

@@ -17,6 +17,7 @@
(function(window) {
'use strict';
/** @constructor */
function GrEventHelper(element) {
this.element = element;
this._unsubscribers = [];

View File

@@ -23,6 +23,7 @@
* opt_moduleName is a name of custom element that will be automatically
* inserted on popup opening.
*
* @constructor
* @param {!Object} plugin
* @param {opt_moduleName=} string
*/

View File

@@ -20,6 +20,7 @@
// Prevent redefinition.
if (window.GrRepoApi) { return; }
/** @constructor */
function GrRepoApi(plugin) {
this._hook = null;
this.plugin = plugin;

View File

@@ -17,6 +17,7 @@
(function(window) {
'use strict';
/** @constructor */
function GrSettingsApi(plugin) {
this._title = '(no title)';
// Generate default screen URL token, specific to plugin, and unique(ish).

View File

@@ -22,6 +22,7 @@
let styleObjectCount = 0;
/** @constructor */
function GrStyleObject(rulesStr) {
this._rulesStr = rulesStr;
this._className = `__pg_js_api_class_${styleObjectCount}`;

View File

@@ -20,6 +20,7 @@
// Prevent redefinition.
if (window.GrThemeApi) { return; }
/** @constructor */
function GrThemeApi(plugin) {
this.plugin = plugin;
}

View File

@@ -17,6 +17,7 @@
(function(window) {
'use strict';
/** @constructor */
function GrAnnotationActionsInterface(plugin) {
this.plugin = plugin;
// Return this instance when there is an annotatediff event.
@@ -168,6 +169,7 @@
/**
* Used to create an instance of the Annotation Layer interface.
*
* @constructor
* @param {String} path The file path (eg: /COMMIT_MSG').
* @param {String} changeNum The Gerrit change number.
* @param {String} patchNum The Gerrit patch number.

View File

@@ -33,6 +33,7 @@
/**
* @deprecated
* @constructor
*/
function GrChangeReplyInterfaceOld(el) {
this._el = el;

View File

@@ -17,6 +17,7 @@
(function(window) {
'use strict';
/** @constructor */
function GrPluginEndpoints() {
this._endpoints = {};
this._callbacks = {};

View File

@@ -45,13 +45,17 @@
STYLE: 'style',
};
/**
* @constructor
* @param {string=} opt_url
*/
function Plugin(opt_url) {
this._domHooks = new GrDomHooksManager(this);
if (!opt_url) {
console.warn('Plugin not being loaded from /plugins base path.',
'Unable to determine name.');
return;
return this;
}
this.deprecated = {
_loadedGwt: deprecatedAPI._loadedGwt.bind(this),
@@ -226,7 +230,7 @@
* @example
* const pluginRestApi = plugin.restApi(plugin.url());
*
* @param {string} Base url for subsequent .get(), .post() etc requests.
* @param {string=} opt_prefix url for subsequent .get(), .post() etc requests.
*/
Plugin.prototype.restApi = function(opt_prefix) {
return new GrPluginRestApi(opt_prefix);

View File

@@ -29,6 +29,7 @@
* in the text as well as custom links if any are specified in the linkConfig
* parameter.
*
* @constructor
* @param {Object|null|undefined} linkConfig Comment links as specified by the
* commentlinks field on a project config.
* @param {Function} callback The callback to be fired when an intermediate

View File

@@ -23,6 +23,7 @@
// Limit cache size because /change/detail responses may be large.
const MAX_CACHE_SIZE = 30;
/** @constructor */
function GrEtagDecorator() {
this._etags = new Map();
this._payloadCache = new Map();

View File

@@ -20,6 +20,7 @@
// Prevent redefinition.
if (window.GrReviewerUpdatesParser) { return; }
/** @constructor */
function GrReviewerUpdatesParser(change) {
this.result = Object.assign({}, change);
this._lastState = {};

View File

@@ -20,6 +20,7 @@ limitations under the License.
'use strict';
/**
* @constructor
* @param {Object} change A change object resulting from a change detail
* call that includes revision information.
*/