mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-17 11:32:27 +00:00
feat(Parser): Add ToggleFormField node (#902)
* Add ToggleFormField node * chore: clean up & lint --------- Co-authored-by: Luan <luan.lrt4@gmail.com>
This commit is contained in:
24
src/parser/classes/ToggleFormField.ts
Normal file
24
src/parser/classes/ToggleFormField.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { type RawNode } from '../index.js';
|
||||
import { YTNode } from '../helpers.js';
|
||||
import NavigationEndpoint from './NavigationEndpoint.js';
|
||||
|
||||
export default class ToggleFormField extends YTNode {
|
||||
static type = 'ToggleFormField';
|
||||
|
||||
public label: Text;
|
||||
public toggled: boolean;
|
||||
public toggle_on_action?: NavigationEndpoint;
|
||||
public toggle_off_action?: NavigationEndpoint;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.label = new Text(data.label);
|
||||
this.toggled = data.toggled;
|
||||
|
||||
if ('toggleOnAction' in data)
|
||||
this.toggle_on_action = new NavigationEndpoint(data.toggleOnAction);
|
||||
|
||||
if ('toggleOffAction' in data)
|
||||
this.toggle_off_action = new NavigationEndpoint(data.toggleOffAction);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user