|
|
@ -15,6 +15,7 @@ export default class Chapter {
|
|
|
|
#summary!: string;
|
|
|
|
#summary!: string;
|
|
|
|
#startNote!: string;
|
|
|
|
#startNote!: string;
|
|
|
|
#endNote!: string;
|
|
|
|
#endNote!: string;
|
|
|
|
|
|
|
|
earlyName?: string;
|
|
|
|
id!: Promise<ID>;
|
|
|
|
id!: Promise<ID>;
|
|
|
|
workID!: Promise<ID>;
|
|
|
|
workID!: Promise<ID>;
|
|
|
|
name!: Promise<string>;
|
|
|
|
name!: Promise<string>;
|
|
|
@ -24,16 +25,26 @@ export default class Chapter {
|
|
|
|
startNote!: Promise<string>;
|
|
|
|
startNote!: Promise<string>;
|
|
|
|
endNote!: Promise<string>;
|
|
|
|
endNote!: Promise<string>;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(workId: ID, id: ID, session: {
|
|
|
|
constructor(
|
|
|
|
get: (path: string) => Promise<Response>;
|
|
|
|
workId: ID,
|
|
|
|
}, DOMParser: DOMParser) {
|
|
|
|
id: ID,
|
|
|
|
|
|
|
|
session: {
|
|
|
|
|
|
|
|
get: (path: string) => Promise<Response>;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
DOMParser: DOMParser,
|
|
|
|
|
|
|
|
extraInfo: Record<string, any>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
this.#session = session;
|
|
|
|
this.#session = session;
|
|
|
|
this.#workID = workId;
|
|
|
|
this.#workID = workId;
|
|
|
|
this.#id = id;
|
|
|
|
this.#id = id;
|
|
|
|
this.#DOMParser = DOMParser;
|
|
|
|
this.#DOMParser = DOMParser;
|
|
|
|
|
|
|
|
this.earlyName = extraInfo.name;
|
|
|
|
|
|
|
|
|
|
|
|
return new Proxy(this, {
|
|
|
|
return new Proxy(this, {
|
|
|
|
get: async (target, prop) => {
|
|
|
|
get: async (target, prop) => {
|
|
|
|
|
|
|
|
if (prop === "earlyName") {
|
|
|
|
|
|
|
|
return this.earlyName;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!this.isInited) {
|
|
|
|
if (!this.isInited) {
|
|
|
|
await target.init();
|
|
|
|
await target.init();
|
|
|
|
target.isInited = true;
|
|
|
|
target.isInited = true;
|
|
|
|