mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-16 11:02:10 +00:00
* dev: refactor and remove redundant code * docs(music): update `Library` API ref * docs: update examples * chore: update lock file
44 lines
867 B
TypeScript
44 lines
867 B
TypeScript
import Parser from '../index';
|
|
import { YTNode } from '../helpers';
|
|
|
|
class Grid extends YTNode {
|
|
static type = 'Grid';
|
|
|
|
items;
|
|
is_collapsible?: boolean;
|
|
visible_row_count?: string;
|
|
target_id?: string;
|
|
continuation: string | null;
|
|
header?;
|
|
|
|
constructor(data: any) {
|
|
super();
|
|
|
|
this.items = Parser.parseArray(data.items);
|
|
|
|
if (data.header) {
|
|
this.header = Parser.parse(data.header);
|
|
}
|
|
|
|
if (data.isCollapsible) {
|
|
this.is_collapsible = data.isCollapsible;
|
|
}
|
|
|
|
if (data.visibleRowCount) {
|
|
this.visible_row_count = data.visibleRowCount;
|
|
}
|
|
|
|
if (data.targetId) {
|
|
this.target_id = data.targetId;
|
|
}
|
|
|
|
this.continuation = data.continuations?.[0]?.nextContinuationData?.continuation || null;
|
|
}
|
|
|
|
// XXX: alias for consistency
|
|
get contents() {
|
|
return this.items;
|
|
}
|
|
}
|
|
|
|
export default Grid; |