@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
36 lines • 1.16 kB
JavaScript
import { XMLEditor } from "../Serialization/XMLEditor.js";
import { ImportFileCompiler } from "./ImportFileCompiler.js";
/**
* Provides the functionality to compile files with an import- and a delete-section.
*
* @template TItem
* The type of the item which can be compiled by this compiler.
*
* @template TObject
* The type of the information that is required for serializing an object-deletion.
*/
export class ObjectDeletionFileCompiler extends ImportFileCompiler {
/**
* Initializes a new instance of the {@link ObjectDeletionFileCompiler `ObjectDeletionFileCompiler<TItem, TObject>`} class.
*
* @param item
* The item to compile.
*/
constructor(item) {
super(item);
}
/**
* Serializes the delete-section of the document.
*
* @returns
* The serialized deletion.
*/
CreateDelete() {
let editor = new XMLEditor(super.CreateDelete());
for (let objectToDelete of this.Item.ObjectsToDelete) {
editor.Add(this.CreateDeleteObject(objectToDelete));
}
return editor.Element;
}
}
//# sourceMappingURL=ObjectDeletionFileCompiler.js.map