MCPcopy Index your code
hub / github.com/MALSync/MALSync / imageFallback

Method imageFallback

src/pages-sync/syncPage.ts:965–994  ·  view source on GitHub ↗
(state: pageState)

Source from the content-addressed store, hash-verified

963 protected imageFallbackInterval: NodeJS.Timeout | undefined = undefined;
964
965 imageFallback(state: pageState) {
966 clearInterval(this.imageFallbackInterval);
967 if (
968 this.singleObj &&
969 typeof this.singleObj.setImage !== 'undefined' &&
970 (this.page.getImage || this.page.sync.getImage || this.page.overview?.getImage)
971 ) {
972 this.imageFallbackInterval = setInterval(() => imageFallbackInternal.call(this), 30 * 1000);
973 imageFallbackInternal.call(this);
974 }
975
976 async function imageFallbackInternal() {
977 let image: string | undefined;
978 if (this.page.getImage) {
979 image = await this.page.getImage();
980 }
981 if (!image && this.page.sync.getImage && state.on === 'SYNC') {
982 image = this.page.sync.getImage();
983 }
984 if (!image && this.page.overview?.getImage && state.on === 'OVERVIEW') {
985 image = this.page.overview.getImage();
986 }
987
988 if (image) {
989 con.log('Image Fallback', image);
990 clearInterval(this.imageFallbackInterval);
991 this.singleObj.setImage(image);
992 }
993 }
994 }
995
996 incorrectUrl() {
997 utils.flashm('Incorrect url provided', {

Callers 1

handlePageMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected