MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / apply

Method apply

src/actions/HideVideo.ts:26–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 }
25
26 override async apply(): Promise<void> {
27 const element = this.engine.element().find(`[data-video="${this.name}"]`);
28 const videoElement = element.get(0) as HTMLVideoElement | undefined;
29
30 if (this.classes.length > 0) {
31 element.addClass('animated');
32 for (const newClass of this.classes) {
33 if (newClass) {
34 element.addClass(newClass);
35 }
36 }
37
38 element.data('visibility', 'invisible');
39 element.on('animationend', (e: Event) => {
40 const target = e.target as HTMLVideoElement;
41 if (target.dataset?.visibility === 'invisible') {
42 // Cleanup video before removal
43 Video.cleanupVideoElement(target);
44 target.remove();
45 }
46 });
47 } else {
48 // Cleanup video before removal
49 if (videoElement) {
50 Video.cleanupVideoElement(videoElement);
51 }
52 element.remove();
53 }
54 }
55
56 override async didApply(): Promise<ActionApplyResult> {
57 let found = false;

Callers 1

revertMethod · 0.45

Calls 5

cleanupVideoElementMethod · 0.80
getMethod · 0.65
onMethod · 0.65
removeMethod · 0.65
elementMethod · 0.45

Tested by

no test coverage detected