Files
YouTube.js/deno/src/parser/classes/PlaylistPanelVideoWrapper.ts
2023-04-29 05:15:47 +00:00

19 lines
704 B
TypeScript

import Parser, { type RawNode } from '../index.ts';
import { type ObservedArray, YTNode, observe } from '../helpers.ts';
import PlaylistPanelVideo from './PlaylistPanelVideo.ts';
export default class PlaylistPanelVideoWrapper extends YTNode {
static type = 'PlaylistPanelVideoWrapper';
primary: PlaylistPanelVideo | null;
counterpart?: ObservedArray<PlaylistPanelVideo>;
constructor(data: RawNode) {
super();
this.primary = Parser.parseItem(data.primaryRenderer, PlaylistPanelVideo);
if (Reflect.has(data, 'counterpart')) {
this.counterpart = observe(data.counterpart.map((item: RawNode) => Parser.parseItem(item.counterpartRenderer, PlaylistPanelVideo)) || []);
}
}
}