clean up of packer
This commit is contained in:
@ -10,15 +10,20 @@ import { Formatter } from "../formatter";
|
|||||||
|
|
||||||
export abstract class Packer {
|
export abstract class Packer {
|
||||||
protected archive: any;
|
protected archive: any;
|
||||||
protected document: Document;
|
|
||||||
private formatter: Formatter;
|
private formatter: Formatter;
|
||||||
private style: Styles;
|
private style: Styles;
|
||||||
private properties: Properties;
|
|
||||||
private numbering: Numbering;
|
|
||||||
|
|
||||||
constructor(document: Document, style?: Styles, properties?: Properties, numbering?: Numbering) {
|
constructor(
|
||||||
|
protected document: Document,
|
||||||
|
style?: Styles,
|
||||||
|
private properties: Properties = new Properties({
|
||||||
|
creator: "Un-named",
|
||||||
|
revision: "1",
|
||||||
|
lastModifiedBy: "Un-named",
|
||||||
|
}),
|
||||||
|
private numbering: Numbering = new Numbering(),
|
||||||
|
) {
|
||||||
this.formatter = new Formatter();
|
this.formatter = new Formatter();
|
||||||
this.document = document;
|
|
||||||
this.archive = archiver.create("zip", {});
|
this.archive = archiver.create("zip", {});
|
||||||
|
|
||||||
if (style) {
|
if (style) {
|
||||||
@ -28,22 +33,6 @@ export abstract class Packer {
|
|||||||
this.style = stylesFactory.newInstance();
|
this.style = stylesFactory.newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties) {
|
|
||||||
this.properties = properties;
|
|
||||||
} else {
|
|
||||||
this.properties = new Properties({
|
|
||||||
creator: "Un-named",
|
|
||||||
revision: "1",
|
|
||||||
lastModifiedBy: "Un-named",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numbering) {
|
|
||||||
this.numbering = numbering;
|
|
||||||
} else {
|
|
||||||
this.numbering = new Numbering();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.archive.on("error", (err) => {
|
this.archive.on("error", (err) => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user