例如,Discord 和 Messenger 中社区聊天的分类法不同,但它们提供相同的功能:
不和谐 | 信使 |
---|---|
服务器 | 社区 |
文字频道/论坛频道 | 社区聊天 |
频道主题/论坛帖子 | 边聊 |
在我的代码中,我想使用 Discord 的分类法来获得更好的可读性体验。是否有一个标签来记录变量名称在另一个分类中可以不同?
/**
* @tagForFunctionName doStuff - This can work on both Discord servers or Messenger community
* @tagForVariableName server, servers - In Discord it's called server. In Messenger it's call community
* @tagForVariableName channel, channels - In Discord it's called channel. In Messenger it's call community chat
* @tagForVariableName thread, threads - In Discord it's called thread or topic. In Messenger it's call sidechat
*/
function doStuff(){
const server = ...
const servers = ...
const channel = ...
const channels = ...
const thread = ...
const threads = ...
}
使用来自 json 链接数据的标签 @context 标签。然后在链接文档中(在注释或单独文档内)使用 Json 链接数据定义替代标识符名称。
/**
* This function does 1, 2, 3, 4
*
* @see 'JSON-LD the context' https://www.w3.org/TR/json-ld/#the-context
* @context: {
* doStuff: "http://path-to-doStuff-documentation-at-Messenger",
* server: "http://path-to-community-docs-at-Messenger",
* channel: "http://path-to-community-chat-docs-at-Messenger",
* thread: "http://path-to-topic-documentation-at-Messenger"
* }
*/
function doStuff() {
const server = ...
const channel = ...
const thread = ...
}