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

AnswerViewController

Extends:

ViewController → AnswerViewController

Manages an answer of a given id.

Constructor Summary

Public Constructor
public

constructor(answer: HTMLElement, answerId: number)

Member Summary

Public Members
public get
public get

body: HTMLElement

Gets the node where the body is

public get

byteCount: HTMLElement

Returns the byte count element.

public set

Sets the byte count.

public
public
public get

Gets if deleted or no.

public set

Sets if deleted or no.

public

Method Summary

Public Methods
public

async setAnswer(newAnswer: Answer)

Sets the answer.

public

async setBody(code: string, language: Language)

Sets the code

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(answer: HTMLElement, answerId: number) source

Override:

ViewController#constructor

Params:

NameTypeAttributeDescription
answer HTMLElement
answerId number

Public Members

public get answer: Answer source

public get body: HTMLElement source

Gets the node where the body is

public get byteCount: HTMLElement source

Returns the byte count element. For the value use .answer.length

public set byteCount: number source

Sets the byte count.

public deletionController: DeleteItemViewController source

public editAnswerController: EditAnswerViewController source

public get isDeleted: boolean source

Gets if deleted or no.

public set isDeleted: boolean source

Sets if deleted or no. This does NOT affect the model use a Request.

public nukeController: NukeItemViewController source

Public Methods

public async setAnswer(newAnswer: Answer) source

Sets the answer. Does NOT update model

Params:

NameTypeAttributeDescription
newAnswer Answer

public async setBody(code: string, language: Language) source

Sets the code

Params:

NameTypeAttributeDescription
code string
language Language