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

Method apply

src/actions/Message.ts:82–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80 }
81
82 override async apply(): Promise<void> {
83 Message.blocking = true;
84
85 const element = document.createElement('message-modal');
86
87 if (typeof this.message.title === 'string') {
88 (element as any).setProps({
89 title: this.engine.replaceVariables(this.message.title)
90 });
91 }
92
93 if (typeof this.message.subtitle === 'string') {
94 (element as any).setProps({
95 subtitle: this.engine.replaceVariables(this.message.subtitle)
96 });
97 }
98
99 if (typeof this.message.body === 'string') {
100 (element as any).setProps({
101 body: this.engine.replaceVariables(this.message.body)
102 });
103 }
104
105 if (typeof this.message.actionString === 'string') {
106 (element as any).setProps({
107 actionString: this.engine.replaceVariables(this.message.actionString)
108 });
109 }
110
111 for (const newClass of this.classes) {
112 if (newClass) {
113 element.classList.add(newClass);
114 }
115 }
116
117 this.engine.element().find('[data-screen="game"]').append(element);
118 }
119
120 override async revert(): Promise<void> {
121 const messageModal = this.engine.component('message-modal') as { instances?: () => { remove: () => void } } | undefined;

Callers 1

revertMethod · 0.95

Calls 2

replaceVariablesMethod · 0.80
elementMethod · 0.45

Tested by

no test coverage detected