Home Reference Source
import VoteViewController from '~/controllers/VoteViewController.js'
public class | source

VoteViewController

Extends:

ViewController → VoteViewController

Controls voting

Constructor Summary

Public Constructor
public

constructor(voteButton: HTMLElement)

Method Summary

Public Methods
public abstract

getRequest(voteType: string, status: boolean): Request

Returns a vote request for the data

public

Sets the loading state

public

async setVote(status: boolean)

What to set vote too.

public

Sets vote activity

public

Sets the vote total

public

Toggles vote controller value.

Inherited Summary

From class ViewController
public static

forClass(className: string, predicate: Function, root: HTMLElement)

Creates a view controller directly for all members of a class.

public static

of(elem: string | Element): ViewController

Returns a canolical VC of an element if it exists

Public Constructors

public constructor(voteButton: HTMLElement) source

Override:

ViewController#constructor

Params:

NameTypeAttributeDescription
voteButton HTMLElement

Public Methods

public abstract getRequest(voteType: string, status: boolean): Request source

Returns a vote request for the data

Params:

NameTypeAttributeDescription
voteType string
status boolean

Return:

Request

public setLoading(state: boolean) source

Sets the loading state

Params:

NameTypeAttributeDescription
state boolean

public async setVote(status: boolean) source

What to set vote too.

Params:

NameTypeAttributeDescription
status boolean

public setVoteActivity(activity: boolean) source

Sets vote activity

Params:

NameTypeAttributeDescription
activity boolean

vote activity

public setVoteTotal(value: number) source

Sets the vote total

Params:

NameTypeAttributeDescription
value number

total number amount of votes

public toggleState() source

Toggles vote controller value.