Commit 55f7d884 authored by Fred Chasen's avatar Fred Chasen

Add eslint, fix chunker

parent 77aaeb27
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"globals": {
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 9
},
"rules": {
"indent": [
"error",
"tab",
{ "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } }
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"warn",
"double"
],
"semi": [
"error",
"always"
],
"no-unused-vars" : ["warn"],
"no-console" : ["warn"],
"no-unused-vars": [
"error",
{ "vars": "all", "args": "none" }
],
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
"valid-jsdoc": ["warn"]
}
};
......@@ -4,12 +4,7 @@ import EventEmitter from "event-emitter";
import Hook from "../utils/hook";
import Queue from "../utils/queue";
import {
needsBreakBefore,
needsBreakAfter
} from "../utils/dom";
import {
requestIdleCallback,
defer
requestIdleCallback
} from "../utils/utils";
const MAX_PAGES = false;
......@@ -174,7 +169,7 @@ class Chunker {
let result;
while (!done) {
result = await this.q.enqueue(async () => { return this.renderOnIdle(renderer) });
result = await this.q.enqueue(async () => { return this.renderOnIdle(renderer); });
done = result.done;
}
......@@ -309,7 +304,8 @@ class Chunker {
let lastPage = this.pages[this.pages.length - 1];
// Create a new page from the template
let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
let total = this.pages.push(page);
this.pages.push(page);
// Create the pages
page.create(undefined, lastPage && lastPage.element);
......@@ -397,7 +393,7 @@ class Chunker {
}
set total(num) {
this.pagesArea.style.setProperty('--page-count', num);
this.pagesArea.style.setProperty("--page-count", num);
this._total = num;
}
......@@ -410,17 +406,17 @@ class Chunker {
}, (r) => {
console.warn("Failed to preload font-family:", fontFace.family);
return fontFace.family;
})
});
fontPromises.push(fontLoaded);
}
});
return Promise.all(fontPromises).catch((err) => {
console.warn(err)
})
console.warn(err);
});
}
destroy() {
this.pagesArea.remove()
this.pagesArea.remove();
this.pageTemplate.remove();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment