EmbyCrackedClient/web/modules/emby-elements/emby-itemrefreshindicator/emby-itemrefreshindicator.js

1 line
1.4 KiB
JavaScript
Raw Permalink Normal View History

2025-06-25 11:46:04 +08:00
import events from"./../../emby-apiclient/events.js";import serverNotifications from"./../../common/input/api.js";import itemShortcuts from"./../../shortcuts.js";import EmbyProgressRing from"./../emby-progressring/emby-progressring.js";function addNotificationEvent(instance,name,handler){handler=handler.bind(instance);events.on(serverNotifications,name,handler),instance[name]=handler}function removeNotificationEvent(instance,name){var handler=instance[name];handler&&(events.off(serverNotifications,name,handler),instance[name]=null)}function onRefreshProgress(e,apiClient,info){var item;this.itemId||(item=itemShortcuts.getItemFromChildNode(this))&&(this.itemId=item.Id),info.ItemId===this.itemId&&((item=parseFloat(info.Progress))&&item<100?this.classList.remove("hide"):this.classList.add("hide"),this.setProgress(item))}function onInit(){this.hasInit||(this.hasInit=!0)}class EmbyItemRefreshIndicator extends EmbyProgressRing{constructor(){var self=super();return onInit.call(self),self}connectedCallback(){EmbyProgressRing.prototype.connectedCallback.call(this),addNotificationEvent(this,"RefreshProgress",onRefreshProgress)}disconnectedCallback(){EmbyProgressRing.prototype.disconnectedCallback.call(this),removeNotificationEvent(this,"RefreshProgress"),this.itemId=null}}customElements.define("emby-itemrefreshindicator",EmbyItemRefreshIndicator,{extends:"div"});export default EmbyProgressRing;