Files
YouTube.js/src/parser/classes/SearchSubMenu.ts
LuanRT 6997982cf2 feat(parser): Add SearchHeader
We may want to remove the old SearchSubMenu node in the future but YouTube still uses it sometimes, so we will keep it for now.

Closes #452
2023-07-24 20:26:05 -03:00

26 lines
795 B
TypeScript

import { type ObservedArray, YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import Parser from '../index.js';
import Text from './misc/Text.js';
import SearchFilterGroup from './SearchFilterGroup.js';
import ToggleButton from './ToggleButton.js';
export default class SearchSubMenu extends YTNode {
static type = 'SearchSubMenu';
title?: Text;
groups?: ObservedArray<SearchFilterGroup>;
button?: ToggleButton | null;
constructor(data: RawNode) {
super();
if (Reflect.has(data, 'title'))
this.title = new Text(data.title);
if (!Reflect.has(data, 'groups'))
this.groups = Parser.parseArray(data.groups, SearchFilterGroup);
if (Reflect.has(data, 'button'))
this.button = Parser.parseItem(data.button, ToggleButton);
}
}