MCPcopy
hub / github.com/iChochy/NCE / constructor

Method constructor

js/ReadingSystem.js:25–57  ·  view source on GitHub ↗

* 构造函数 * @param {Object} [config={}] - 配置选项

(config = {})

Source from the content-addressed store, hash-verified

23 * @param {Object} [config={}] - 配置选项
24 */
25 constructor(config = {}) {
26 // 初始化状态
27 this.state = createInitialState();
28
29 // 初始化 DOM 引用
30 this.dom = createDOMReferences();
31
32 // 合并配置
33 this.config = mergeObjects(CONFIG, config);
34
35 // 初始化管理器
36 this.lrcCache = new CacheManager(this.config.PLAYER.MAX_LRC_CACHE);
37 this.audioPreload = new CacheManager(this.config.PLAYER.MAX_AUDIO_CACHE);
38 this.resourceLoader = new ResourceLoader();
39 this.eventManager = new EventManager();
40
41 // 歌词行 DOM 元素缓存
42 this.lyricLineEls = [];
43
44 // 事件绑定标记,防止重复绑定
45 this.bindingFlags = {
46 unitSelect: false,
47 unitList: false,
48 bookSelects: false,
49 lyrics: false,
50 playerControls: false,
51 navigation: false,
52 translationToggle: false,
53 };
54
55 // 启动初始化
56 this.init();
57 }
58
59 // =========================================================================
60 // 初始化流程

Callers

nothing calls this directly

Calls 4

initMethod · 0.95
createInitialStateFunction · 0.90
createDOMReferencesFunction · 0.90
mergeObjectsFunction · 0.90

Tested by

no test coverage detected