- Docs (JSDoc): Further on preferring void

This commit is contained in:
Brett Zamir
2019-04-16 08:59:16 +08:00
parent 894fed3e80
commit d84f39cb3f
62 changed files with 576 additions and 575 deletions

View File

@@ -22,7 +22,7 @@ export default {
/**
* @param {Window} win
* @param {!(string|Integer)} n
* @returns {undefined}
* @returns {void}
*/
function setArrowNonce (win, n) {
randomizeIds = true;
@@ -33,7 +33,7 @@ export default {
/**
* @param {Window} win
* @returns {undefined}
* @returns {void}
*/
function unsetArrowNonce (win) {
randomizeIds = false;
@@ -74,7 +74,7 @@ export default {
/**
* @param {boolean} on
* @returns {undefined}
* @returns {void}
*/
function showPanel (on) {
$('#arrow_panel').toggle(on);
@@ -107,7 +107,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function resetMarker () {
const el = selElems[0];
@@ -165,7 +165,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function setArrow () {
resetMarker();
@@ -196,7 +196,7 @@ export default {
/**
* @param {Element} elem
* @returns {undefined}
* @returns {void}
*/
function colorChanged (elem) {
const color = elem.getAttribute('stroke');

View File

@@ -89,7 +89,7 @@ export default {
/**
* @param {boolean} on
* @returns {undefined}
* @returns {void}
*/
function showPanel (on) {
let connRules = $('#connector_rules');
@@ -106,7 +106,7 @@ export default {
* @param {Float} x
* @param {Float} y
* @param {boolean} [setMid]
* @returns {undefined}
* @returns {void}
*/
function setPoint (elem, pos, x, y, setMid) {
const pts = elem.points;
@@ -139,7 +139,7 @@ export default {
/**
* @param {Float} diffX
* @param {Float} diffY
* @returns {undefined}
* @returns {void}
*/
function updateLine (diffX, diffY) {
// Update line with element
@@ -178,7 +178,7 @@ export default {
/**
*
* @param {Element[]} [elems=selElems] Array of elements
* @returns {undefined}
* @returns {void}
*/
function findConnectors (elems = selElems) {
const connectors = $(svgcontent).find(connSel);
@@ -189,7 +189,7 @@ export default {
let addThis;
/**
*
* @returns {undefined}
* @returns {void}
*/
function add () {
if (elems.includes(this)) {
@@ -240,7 +240,7 @@ export default {
/**
* @param {Element[]} [elems=selElems]
* @returns {undefined}
* @returns {void}
*/
function updateConnectors (elems) {
// Updates connector lines based on selected elements
@@ -317,7 +317,7 @@ export default {
/**
* Do on reset.
* @returns {undefined}
* @returns {void}
*/
function init () {
// Make sure all connectors have data set

View File

@@ -28,7 +28,7 @@ export default {
/**
*
* @param {module:svgcanvas.SvgCanvas#event:ext-selectedChanged|module:svgcanvas.SvgCanvas#event:ext-elementChanged} opts
* @returns {undefined}
* @returns {void}
*/
function getStyle (opts) {
// if we are in eyedropper mode, we don't want to disable the eye-dropper tool

View File

@@ -27,7 +27,7 @@ export default {
/**
* @param {boolean} on
* @returns {undefined}
* @returns {void}
*/
function showPanel (on) {
let fcRules = $('#fc_rules');
@@ -40,7 +40,7 @@ export default {
/**
* @param {boolean} on
* @returns {undefined}
* @returns {void}
*/
function toggleSourceButtons (on) {
$('#tool_source_save, #tool_source_cancel').toggle(!on);
@@ -78,7 +78,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function showForeignEditor () {
const elt = selElems[0];
@@ -97,7 +97,7 @@ export default {
/**
* @param {string} attr
* @param {string|Float} val
* @returns {undefined}
* @returns {void}
*/
function setAttr (attr, val) {
svgCanvas.changeSelectedAttribute(attr, val);

View File

@@ -74,7 +74,7 @@ export default {
/**
*
* @param {Float} zoom
* @returns {undefined}
* @returns {void}
*/
function updateGrid (zoom) {
// TODO: Try this with <line> elements, then compare performance difference
@@ -127,7 +127,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function gridUpdate () {
if (showGrid) {

View File

@@ -41,7 +41,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function closeBrowser () {
$('#imgbrowse_holder').hide();
@@ -49,7 +49,7 @@ export default {
/**
* @param {string} url
* @returns {undefined}
* @returns {void}
*/
function importImage (url) {
const newImage = svgCanvas.addSVGElementFromJson({
@@ -289,7 +289,7 @@ export default {
/**
* @param {boolean} show
* @returns {undefined}
* @returns {void}
*/
function toggleMulti (show) {
$('#lib_framewrap, #imglib_opts').css({right: (show ? 200 : 10)});
@@ -333,7 +333,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function showBrowser () {
let browser = $('#imgbrowse');

View File

@@ -97,7 +97,7 @@ export default {
*
* @param {"start"|"mid"|"end"} pos
* @param {string} id
* @returns {undefined}
* @returns {void}
*/
function setIcon (pos, id) {
if (id.substr(0, 1) !== '\\') { id = '\\textmarker'; }
@@ -111,7 +111,7 @@ export default {
* Toggles context tool panel off/on. Sets the controls with the
* selected element's settings.
* @param {boolean} on
* @returns {undefined}
* @returns {void}
*/
function showPanel (on) {
$('#marker_panel').toggle(on);
@@ -147,7 +147,7 @@ export default {
/**
* @param {string} id
* @param {""|"\\nomarker"|"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} val
* @returns {undefined}
* @returns {void}
*/
function addMarker (id, val) {
const txtBoxBg = '#ffffff';
@@ -295,7 +295,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function setMarker () {
const poslist = {start_marker: 'start', mid_marker: 'mid', end_marker: 'end'};
@@ -327,7 +327,7 @@ export default {
* Called when the main system modifies an object. This routine changes
* the associated markers to be the same color.
* @param {Element} elem
* @returns {undefined}
* @returns {void}
*/
function colorChanged (elem) {
const color = elem.getAttribute('stroke');
@@ -349,7 +349,7 @@ export default {
* Called when the main system creates or modifies an object.
* Its primary purpose is to create new markers for cloned objects.
* @param {Element} el
* @returns {undefined}
* @returns {void}
*/
function updateReferences (el) {
$.each(mtypes, function (i, pos) {
@@ -376,7 +376,7 @@ export default {
/**
* @param {"start"|"mid"|"end"} pos
* @param {string} val
* @returns {undefined}
* @returns {void}
*/
function triggerTextEntry (pos, val) {
$('#' + pos + '_marker').val(val);
@@ -443,7 +443,7 @@ export default {
/**
* @param {"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} id
* @returns {undefined}
* @returns {void}
*/
function getTitle (id) {
const {langList} = strings;

View File

@@ -67,7 +67,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function saveMath () {
const code = $('#mathjax_code_textarea').val();

View File

@@ -55,7 +55,7 @@ export default {
/**
*
* @param {boolean} on
* @returns {undefined}
* @returns {void}
*/
function showPanel (on) {
$('#placemark_panel').toggle(on);
@@ -80,7 +80,7 @@ export default {
/**
* Called when text is changed.
* @param {string} txt
* @returns {undefined}
* @returns {void}
*/
function updateText (txt) {
const items = txt.split(';');
@@ -98,7 +98,7 @@ export default {
/**
* Called when font is changed.
* @param {string} font
* @returns {undefined}
* @returns {void}
*/
function updateFont (font) {
font = font.split(' ');
@@ -118,7 +118,7 @@ export default {
/**
* @param {string} id
* @param {""|"\\nomarker"|"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"textmarker_top"|"textmarker_bottom"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} val
* @returns {undefined}
* @returns {void}
*/
function addMarker (id, val) {
let marker = svgCanvas.getElem(id);
@@ -177,7 +177,7 @@ export default {
/**
* @param {Element} el
* @param {string} val
* @returns {undefined}
* @returns {void}
*/
function setMarker (el, val) {
const markerName = 'marker-start';
@@ -199,7 +199,7 @@ export default {
* Called when the main system modifies an object. This routine changes
* the associated markers to be the same color.
* @param {Element} el
* @returns {undefined}
* @returns {void}
*/
function colorChanged (el) {
const color = el.getAttribute('stroke');
@@ -219,7 +219,7 @@ export default {
* Called when the main system creates or modifies an object.
* Its primary purpose is to create new markers for cloned objects.
* @param {Element} el
* @returns {undefined}
* @returns {void}
*/
function updateReferences (el) {
const id = 'placemark_marker_' + el.id;
@@ -251,7 +251,7 @@ export default {
/**
* @param {"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} id
* @returns {undefined}
* @returns {void}
*/
function getTitle (id) {
const {langList} = strings;

View File

@@ -38,7 +38,7 @@ export default {
/**
* @param {boolean} on
* @returns {undefined}
* @returns {void}
*/
function showPanel (on) {
let fcRules = $('#fc_rules');
@@ -59,7 +59,7 @@ export default {
/**
* @param {string} attr
* @param {string|Float} val
* @returns {undefined}
* @returns {void}
*/
function setAttr (attr, val) {
svgCanvas.changeSelectedAttribute(attr, val);

View File

@@ -210,7 +210,7 @@ export default {
/**
*
* @param {external:jQuery} form
* @returns {undefined}
* @returns {void}
*/
function rebuildInput (form) {
form.empty();
@@ -219,7 +219,7 @@ export default {
/**
* Submit the form, empty its contents for reuse and show
* uploading message.
* @returns {undefined}
* @returns {void}
*/
async function submit () {
// This submits the form, which returns the file data using `svgEditor.processFile()`

View File

@@ -63,7 +63,7 @@ export default {
/**
*
* @returns {undefined}
* @returns {void}
*/
function loadIcons () {
$('#shape_buttons').empty().append(curLib.buttons);
@@ -79,7 +79,7 @@ export default {
/**
* @param {string|"basic"} cat Category ID
* @param {module:Extension.Shapes.Shapes} shapes
* @returns {undefined}
* @returns {void}
*/
function makeButtons (cat, shapes) {
const size = curLib.size || 300;
@@ -118,7 +118,7 @@ export default {
/**
* @param {string|"basic"} catId
* @returns {undefined}
* @returns {void}
*/
function loadLibrary (catId) {
const lib = library[catId];

View File

@@ -27,7 +27,7 @@ export default {
/**
*
* @param {boolean} on
* @returns {undefined}
* @returns {void}
*/
function showPanel (on) {
let fcRules = $('#fc_rules');
@@ -48,7 +48,7 @@ export default {
*
* @param {string} attr
* @param {string|Float} val
* @returns {undefined}
* @returns {void}
*/
function setAttr (attr, val) {
svgCanvas.changeSelectedAttribute(attr, val);

View File

@@ -50,7 +50,7 @@ export default {
/**
* Replace `storagePrompt` parameter within URL.
* @param {string} val
* @returns {undefined}
* @returns {void}
*/
function replaceStoragePrompt (val) {
val = val ? 'storagePrompt=' + val : '';
@@ -68,7 +68,7 @@ export default {
* Sets SVG content as a string with "svgedit-" and the current
* canvas name as namespace.
* @param {string} val
* @returns {undefined}
* @returns {void}
*/
function setSVGContentStorage (val) {
if (storage) {
@@ -84,7 +84,7 @@ export default {
/**
* Set the cookie to expire.
* @param {string} cookie
* @returns {undefined}
* @returns {void}
*/
function expireCookie (cookie) {
document.cookie = encodeURIComponent(cookie) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT';
@@ -92,7 +92,7 @@ export default {
/**
* Expire the storage cookie.
* @returns {undefined}
* @returns {void}
*/
function removeStoragePrefCookie () {
expireCookie('svgeditstore');
@@ -100,7 +100,7 @@ export default {
/**
* Empties storage for each of the current preferences.
* @returns {undefined}
* @returns {void}
*/
function emptyStorage () {
setSVGContentStorage('');
@@ -122,7 +122,7 @@ export default {
* content into storage)
* 2. Use localStorage to set SVG contents (potentially too large to allow in cookies)
* 3. Use localStorage (where available) or cookies to set preferences.
* @returns {undefined}
* @returns {void}
*/
function setupBeforeUnloadListener () {
window.addEventListener('beforeunload', function (e) {

View File

@@ -22,7 +22,7 @@ export default {
* @param {module:svgcanvas.SvgCanvas#event:message} data
* @listens module:svgcanvas.SvgCanvas#event:message
* @throws {Error} Unexpected event type
* @returns {undefined}
* @returns {void}
*/
(win, {data, origin}) => { // eslint-disable-line no-shadow
// console.log('data, origin', data, origin);

View File

@@ -11,7 +11,7 @@ const jsVoid = 'javascript: void(0);'; // eslint-disable-line no-script-url
/**
* Shows results after query submission.
* @param {string} url
* @returns {undefined}
* @returns {void}
*/
async function processResults (url) {
/**