]> git.kianting.info Git - clo/blob - src/libclo/index.js
add clo library initially with register of prepocessor
[clo] / src / libclo / index.js
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.a = exports.Clo = void 0;
4 function foo(arr) {
5 for (let i = 0; i < arr.length; i++) {
6 }
7 if (Array.isArray(arr)) {
8 arr.push("balabala");
9 }
10 return arr;
11 }
12 class Clo {
13 constructor() {
14 this.preprocessors = [];
15 this.mainStream = [];
16 this.attributes = { "page": [793.7, 1122.5] };
17 this.preprocessorRegister(foo);
18 }
19 /**
20 * register a function of preprocessor
21 * @param f a function
22 */
23 preprocessorRegister(f) {
24 this.preprocessors.push(f);
25 }
26 generatePdf() {
27 // preprocessed
28 var prepro = this.mainStream;
29 for (var i = 0; i < this.preprocessors.length; i++) {
30 prepro = this.preprocessors[i](prepro);
31 }
32 // TODO
33 console.log("test" + prepro);
34 }
35 }
36 exports.Clo = Clo;
37 exports.a = new Clo();
38 exports.default = exports.a;