nx: fix listener

Signed-off-by: Varun Patil <radialapps@gmail.com>
monorepo
Varun Patil 2023-10-31 22:49:17 -07:00
parent 7946abbae4
commit 90ccddd47e
2 changed files with 9 additions and 6 deletions

View File

@ -2,7 +2,7 @@ import { NAPI, nativex } from './api';
import { has } from './basic';
import { API } from '@services/API';
import * as utils from '@services/utils';
import { bus, setRenewingTimeout } from '@services/utils';
import type { IDay, IPhoto } from '@typings';
@ -14,7 +14,9 @@ const seenABUIDs = new Set<string>();
// Clear the cache whenever the timeline is refreshed
if (has()) {
utils.onDOMLoaded(() => utils.bus.on('nativex:db:updated', () => daysCache.clear()));
document.addEventListener('DOMContentLoaded', () => {
bus.on('nativex:db:updated', () => daysCache.clear());
});
}
/**
@ -106,7 +108,7 @@ export function processFreshServerDay(this: any, dayId: number, photos: IPhoto[]
}
// Debounce
utils.setRenewingTimeout(
setRenewingTimeout(
this,
'pfsdq_timer',
() => {

View File

@ -3,7 +3,8 @@ import { getCurrentUser } from '@nextcloud/auth';
import { constants as c } from './const';
import { API } from '@services/API';
import * as nativex from '@native';
import { NAPI } from '@native';
import type { IImageInfo, IPhoto } from '@typings';
/**
@ -67,7 +68,7 @@ export function getPreviewUrl(opts: PreviewOptsSize | PreviewOptsMsize | Preview
// Native preview
if (isLocalPhoto(photo)) {
return API.Q(nativex.NAPI.IMAGE_PREVIEW(photo.fileid), { c: photo.etag });
return API.Q(NAPI.IMAGE_PREVIEW(photo.fileid), { c: photo.etag });
}
// Screen-appropriate size
@ -115,7 +116,7 @@ export function getImageInfoUrl(photo: IPhoto | number): string {
const fileid = typeof photo === 'number' ? photo : photo.fileid;
if (typeof photo === 'object' && isLocalPhoto(photo)) {
return nativex.NAPI.IMAGE_INFO(fileid);
return NAPI.IMAGE_INFO(fileid);
}
return API.IMAGE_INFO(fileid);