jenkins-bot has submitted this change and it was merged. Change subject: Add jsduck docs for ConfirmCloseWindow ......................................................................
Add jsduck docs for ConfirmCloseWindow Starting with something simple, will move forward from here. Note these docs are mostly for people working on UW itself, so it might seem questionably useful, but having a consistent format and a way to check that format is going to prove useful. Change-Id: I018bc4480e9871953a211601cde5f1cad9a4360d --- M .gitignore A docs/external.js A docs/generate A docs/jsduck-config.json M resources/mw.ConfirmCloseWindow.js 5 files changed, 33 insertions(+), 11 deletions(-) Approvals: Alex Monk: Looks good to me, approved jenkins-bot: Verified diff --git a/.gitignore b/.gitignore index 98b092a..4a150c3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *~ *.kate-swp .*.swp +docs/js diff --git a/docs/external.js b/docs/external.js new file mode 100644 index 0000000..7a030d9 --- /dev/null +++ b/docs/external.js @@ -0,0 +1,4 @@ +/** + * @class mw + * <https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw> + */ diff --git a/docs/generate b/docs/generate new file mode 100755 index 0000000..d27dfeb --- /dev/null +++ b/docs/generate @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +jsduck \ +--config=$(pwd)/docs/jsduck-config.json \ +&& echo 'JSDuck execution finished.' diff --git a/docs/jsduck-config.json b/docs/jsduck-config.json new file mode 100644 index 0000000..259a28c --- /dev/null +++ b/docs/jsduck-config.json @@ -0,0 +1,11 @@ +{ + "--title": "UploadWizard extension documentation", + "--footer": "Documentation for UploadWizard, an extension to MediaWiki. Generated on {DATE} by {JSDUCK} {VERSION}.", + "--warnings": ["-no_doc"], + "--builtin-classes": true, + "--output": "./js", + "--": [ + "./external.js", + "../resources/mw.ConfirmCloseWindow.js" + ] +} diff --git a/resources/mw.ConfirmCloseWindow.js b/resources/mw.ConfirmCloseWindow.js index e9bc821..57a87a5 100644 --- a/resources/mw.ConfirmCloseWindow.js +++ b/resources/mw.ConfirmCloseWindow.js @@ -1,21 +1,24 @@ ( function( mw, $, undefined ) { /** + * @method confirmCloseWindow + * @member mw + * * Prevent the closing of a window with a confirm message (the onbeforeunload event seems to * work in most browsers.) * * This supersedes any previous onbeforeunload handler. If there was a handler before, it is * restored when you execute the returned function. - * e.g. * - * var allowCloseWindow = mw.confirmCloseWindow( { message: 'Dont close me!' } ); - * // ... do stuff that can't be interrupted ... - * allowCloseWindow(); + * var allowCloseWindow = mw.confirmCloseWindow(); + * // ... do stuff that can't be interrupted ... + * allowCloseWindow(); * - * - * @param options Optional set of the following optional arguments: - * message: function returning string message to show. - * test: function returning boolean. If true, alert is shown. Defaults to always true. - * @return closure execute this when you want to allow the user to close the window + * @param {Object} [options] + * @param {Function} [options.message] + * @param {string} options.message.return The string message to show in the confirm dialog. + * @param {Function} [options.test] + * @param {boolean} options.test.return Whether to show the dialog to the user. + * @return {Function} Execute this when you want to allow the user to close the window */ mw.confirmCloseWindow = function( options ) { if ( options === undefined ) { @@ -53,5 +56,3 @@ }; } )( window.mediaWiki, jQuery ); - - -- To view, visit https://gerrit.wikimedia.org/r/70912 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I018bc4480e9871953a211601cde5f1cad9a4360d Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/UploadWizard Gerrit-Branch: master Gerrit-Owner: MarkTraceur <[email protected]> Gerrit-Reviewer: Alex Monk <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
