[英]JSDOC on socket.io emit
如果我有這樣的 socketio function:
_sock.emit('app_version',appversion,(response)=>{
console.log(response)
})
我想放一個適當的 JSDOC,解釋 appversion 是一個字符串,而 response 是一個字符串,我該如何寫呢?
目前在 WebStorm 中嘗試了一些組合,如 @param 或 @property,但 Webstorm 仍然無法識別該應用程序版本和響應類型。
請幫忙
如果您在聲明時鍵入內容,JSDoc 效果最好,如果您在內聯執行操作(例如使用內聯箭頭 function),則效果不佳。嘗試這樣的操作,在使用變量和函數之前聲明並鍵入它們:
// Use @type to indicate the type of the next following variable
/**
* @type {string}
*/
let appversion;
// Use @param to indicate the param type of the next following function
/**
* @param {string} response
*/
function doThing(response) {
console.log(response);
}
_sock.emit('app_version', appversion, doThing);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.