@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
54 lines (53 loc) • 1.98 kB
TypeScript
import type { ESLMedia } from './esl-media';
/**
* Manager for {@link ESLMedia}
* Checks whether media should play inside ESLToggleable container,
* stores all active instances and instances marked with `autoplay` attribute
* Restrict that only one media from the group can be played
*
* @author Anastasia Lesun
*/
export declare class ESLMediaManager {
/** All managed instances */
instances: Set<ESLMedia>;
/** Active instances */
get active(): ESLMedia[];
/** Instances with autoplay marker */
get autoplayable(): ESLMedia[];
constructor();
/** Hook for {@link ESLMedia} initialization */
_onInit(media: ESLMedia): void;
/** Hook for {@link ESLMedia} destroy */
_onDestroy(media: ESLMedia): void;
/** Hook for {@link ESLMedia} which is started to play */
_onAfterPlay(media: ESLMedia): void;
/**
* Processes {@link ESLToggleable} show event and resumes all media inside.
* @see {@link ESLMediaManager#releaseAll}
*/
_onContainerShow(e: Event): void;
/**
* Processes {@link ESLToggleable} hide event and systemically suspend all media instances inside.
* @see {@link ESLMediaManager#suspendAll}
*/
protected _onContainerHide(e: Event): void;
/**
* Starts all system-stopped media with autoplay marker
* @param scope - the scope to search for media
* @param system - whether to start only system-stopped media
*/
protected releaseAll(scope?: Element, system?: boolean): void;
/**
* Pauses all active media that was not started manually
* @param scope - the scope to search for media
* @param system - whether to pause only system-active media
*/
protected suspendAll(scope?: Element, system?: boolean): void;
/** Processes request to play/pause media */
protected _onRequest(e: CustomEvent): void;
}
declare global {
export interface ESLLibrary {
ESLMediaManager: typeof ESLMediaManager;
}
}