跳至主内容
非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

JavaScript

文件名

文件名必须采用驼峰式命名法,不得包含下划线 (_) 或短横线 (-)。文件扩展名必须为 .js

文件结构

所有文件必须遵循以下基本结构,JSDoc 注释为可选但建议添加。

/**
* This module documents the structure used by JavaScript code in Jellyfin.
*
* @module path/to/this/module
*/

import module from 'dependency';
import { myFunction, myClass } from 'dependency/submodule';
import 'otherDependency';

/**
* Defines a non-exported function, accessible only from this module.
*
* @param {Object} argument - The argument to pass to the function.
* @returns {Int|null} The resulting object from the function.
*/
function privateFunction (argument) {
// Code omitted
}

export function publicFunction (argument) {
// Code omitted
}

export default { publicFunction }

杂项

文件编码

所有文件必须以 UTF-8 编码格式保存,提交时需使用 LF 换行符。

非 ASCII 字符

对于可打印字符,请直接在代码中使用 Unicode 字符。

对于不可打印字符,请使用十六进制或 Unicode 转义序列。