mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-16 19:12:24 +00:00
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
26 lines
795 B
TypeScript
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);
|
|
}
|
|
} |