style: format code

This commit is contained in:
LuanRT
2022-07-21 03:51:28 -03:00
parent 4bf4639902
commit 60e6326402
269 changed files with 2082 additions and 992 deletions

View File

@@ -6,25 +6,33 @@ import Feed from './Feed';
class TabbedFeed extends Feed {
#tabs;
#actions;
constructor(actions: Actions, data: any, already_parsed = false) {
super(actions, data, already_parsed);
this.#actions = actions;
this.#tabs = this.page.contents_memo.getType(Tab);
}
get tabs() {
return this.#tabs.map((tab) => tab.title.toString());
}
async getTab(title: string) {
const tab = this.#tabs.find((tab) => tab.title.toLowerCase() === title.toLowerCase());
if (!tab)
throw new InnertubeError(`Tab "${title}" not found`);
if (tab.selected)
return this;
const response = await tab.endpoint.call(this.#actions);
return new TabbedFeed(this.#actions, response, true);
}
get title() {
return this.page.contents_memo.getType(Tab)?.find((tab) => tab.selected)?.title.toString();
}
}
export default TabbedFeed;
export default TabbedFeed;