diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-06-26 23:52:06 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-06-26 23:52:06 +0300 |
| commit | 5fe9fbf8e5388c121964cc2ecaae34d92d12f632 (patch) | |
| tree | f667ff5621c5ea881489b5d892aa24efc011f12b | |
| parent | 6e5eca4961d293c01ea4f01ff5323dc137daad8f (diff) | |
| download | the-epube-5fe9fbf8e5388c121964cc2ecaae34d92d12f632.tar.gz the-epube-5fe9fbf8e5388c121964cc2ecaae34d92d12f632.tar.xz | |
more ts migration stuff
| -rw-r--r-- | src/index.d.ts | 5 | ||||
| -rw-r--r-- | src/reader.ts | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/index.d.ts b/src/index.d.ts index 60ffba3..c83ae9b 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -38,6 +38,11 @@ declare interface BookList { limit: number; } +declare interface LastRead { + cfi: string; + page: number; +} + declare var EpubeApp: EpubeApp; declare var localforage: LocalForage; diff --git a/src/reader.ts b/src/reader.ts index 705aab0..ac8c316 100644 --- a/src/reader.ts +++ b/src/reader.ts @@ -251,7 +251,7 @@ class ReaderClass extends AppCommon { console.log('trying to load book...'); - let book_data = await localforage.getItem(this.cacheId("book")); + let book_data = await localforage.getItem(this.cacheId("book")) as Blob; if (!book_data) { console.log("local data not found, loading from network..."); @@ -332,7 +332,7 @@ class ReaderClass extends AppCommon { if (enable_hyphens) { /* global hyphenationPatternsEnUs, hyphenationPatternsRu, createHyphenator */ -(this.hyphenate as any).en = createHyphenator(hyphenationPatternsEnUs, { html: true }); + (this.hyphenate as any).en = createHyphenator(hyphenationPatternsEnUs, { html: true }); (this.hyphenate as any).ru = createHyphenator(hyphenationPatternsRu, { html: true }); } @@ -352,7 +352,7 @@ class ReaderClass extends AppCommon { * @param {ePub.Book} book */ async showBookInfo(book: any) { - const bookinfo = await localforage.getItem(this.cacheId()); + const bookinfo = await localforage.getItem(this.cacheId()) as BookInfo; let title; let author; @@ -602,7 +602,7 @@ class ReaderClass extends AppCommon { initModals() { $('#settings-modal').on('shown.bs.modal', async () => { - const last_read = await localforage.getItem(this.cacheId("lastread")); + const last_read = await localforage.getItem(this.cacheId("lastread")) as LastRead; if (last_read && last_read.cfi) { $(".lastread_input") @@ -1596,7 +1596,7 @@ class ReaderClass extends AppCommon { let location_found = false; - const lr_local = (await localforage.getItem(this.cacheId("lastread"))) || {}; + const lr_local = ((await localforage.getItem(this.cacheId("lastread"))) || {}) as LastRead; console.log('got local lastread', lr_local); if (this.isOnline()) { |
