mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-07-01 20:46:14 +00:00
refactor!: migrate core renderers to TypeScript
This commit is contained in:
24
src/parser/classes/ItemSection.ts
Normal file
24
src/parser/classes/ItemSection.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import Parser from '../index';
|
||||
import ItemSectionHeader from './ItemSectionHeader';
|
||||
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class ItemSection extends YTNode {
|
||||
static type = 'ItemSection';
|
||||
|
||||
header: ItemSectionHeader | null;
|
||||
contents;
|
||||
target_id;
|
||||
|
||||
constructor(data: any) {
|
||||
super();
|
||||
this.header = Parser.parseItem<ItemSectionHeader>(data.header, ItemSectionHeader);
|
||||
this.contents = Parser.parse(data.contents, true);
|
||||
|
||||
if (data.targetId || data.sectionIdentifier) {
|
||||
this.target_id = data?.target_id || data?.sectionIdentifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ItemSection;
|
||||
Reference in New Issue
Block a user