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

Method loadUnitFromStorage

js/ReadingSystem.js:280–286  ·  view source on GitHub ↗

* 从 localStorage 恢复上次学习的单元 * @returns {Promise }

()

Source from the content-addressed store, hash-verified

278 * @returns {Promise<void>}
279 */
280 async loadUnitFromStorage() {
281 if (!this.state.units.length) return;
282
283 const unitIndex = getCurrentUnitIndex(this.state.bookPath);
284 const safeIndex = clamp(unitIndex, 0, this.state.units.length - 1);
285 await this.loadUnitByIndex(safeIndex, { shouldScrollUnitIntoView: true });
286 }
287
288 /**
289 * 根据索引加载指定单元

Callers 2

initMethod · 0.95
bindWindowEventsMethod · 0.95

Calls 3

loadUnitByIndexMethod · 0.95
getCurrentUnitIndexFunction · 0.90
clampFunction · 0.90

Tested by

no test coverage detected