MCPcopy Index your code
hub / github.com/ollm/OpenComic / get

Function get

scripts/reading/progress.js:84–99  ·  view source on GitHub ↗
(path, cache = true, cacheOnly = false)

Source from the content-addressed store, hash-verified

82}
83
84async function get(path, cache = true, cacheOnly = false)
85{
86 const _readPages = await readPages(path);
87 const totalPages = await countPages(path, cache, cacheOnly);
88
89 let percent = (totalPages === 1) ? 0 : ((((_readPages || 1) - 1) / (totalPages - 1)) * 100);
90 if(percent > 100) percent = 100;
91
92 return {
93 read: _readPages,
94 total: totalPages,
95 percent: percent,
96 percentRound: Math.round(percent),
97 completed: (_readPages >= totalPages),
98 };
99}
100
101async function simpleGet(path, cache = true, cacheOnly = false)
102{

Callers 1

updateProgressFunction · 0.70

Calls 2

readPagesFunction · 0.85
countPagesFunction · 0.85

Tested by

no test coverage detected