Skip to content

Refactor/2116 2#2474

Draft
justinmmott wants to merge 2 commits intodteviot:ExperimentalTabModefrom
justinmmott:refactor/2116-2
Draft

Refactor/2116 2#2474
justinmmott wants to merge 2 commits intodteviot:ExperimentalTabModefrom
justinmmott:refactor/2116-2

Conversation

@justinmmott
Copy link
Contributor

Change the rest of the .then()s to async-await.

Ran the tests on the first commit, where there are no changes to the test files, and got all the tests to pass.

It's late, and I haven't given the code a once-over for style mistakes, so leaving this as a draft for now.

await addCssFileToZip(zip, "autoDark.css");
let fileList = await getFileList("../plugin/popup.html");
let localeNames = await getLocaleFilesNames();
["js/ContentScript.js"].concat(localeNames).concat(fileList.filter(n => !n.includes("/experimental/")));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be

fileList = ["js/ContentScript.js"].concat(localeNames).concat(fileList.filter(n => !n.includes("/experimental/")));

So that next line processes the correct list of files


getChapterUrls(dom, chapterUrlsUI) {
return this.getChapterUrlsFromMultipleTocPages(dom,
async getChapterUrls(dom, chapterUrlsUI) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure this needs to be

        return (await this.getChapterUrlsFromMultipleTocPages(dom,
            ComrademaoParser.extractPartialChapterList,
            ComrademaoParser.getUrlsOfTocPages,
            chapterUrlsUI
        )).reverse();

let nextUrl = QinxiaoshuoParser.urlOfNextPageOfChapter(xhr.responseXML, fetchedUrls);
return QinxiaoshuoParser.fetchPagesOfChapter(finalDom, fetchedUrls, nextUrl);
});
let xhr = await HttpClient.wrapFetch(url);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is using recursion due to use of then. Can be re-written as simple iteration.

}.bind(this));
async responseToJson(response) {
let data = await response.text();
this.json = JSON.parse(data);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not returning this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments