import CommentListViewController from '~/controllers/CommentListViewController.js'
CommentListViewController
Extends:
Manages a list of comments
Constructor Summary
Public Constructor | ||
public |
constructor(comment: HTMLElement, owner: Post | Answer, opts: Object) Creates the comment list controller from HTML element. |
Method Summary
Public Methods | ||
public |
addInstance(html: HTMLElement, type: InstanceType) Adds an instance |
|
public |
async createCommentInstance(comment: Comment, type: InstanceType): HTMLElement Creates a comment in the list |
|
public |
Reports an error |
|
public |
createLoadingInstance(message: string, type: InstanceType, animated: boolean): Object Creates a 'loading' instance in this comment list. |
|
public |
async createMultipleCommentInstances(comments: Comment[], type: InstanceType, animated: boolean, constructionOptions: Object): HTMLElement Creates a 'grouped comment' instance. |
|
public |
For static construction this will setup the sublists |
Inherited Summary
From class ViewController | ||
public static |
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(comment: HTMLElement, owner: Post | Answer, opts: Object) source
Creates the comment list controller from HTML element.
Override:
ViewController#constructorPublic Methods
public addInstance(html: HTMLElement, type: InstanceType) source
Adds an instance
Params:
Name | Type | Attribute | Description |
html | HTMLElement | HTML node |
|
type | InstanceType | The instance type |
public async createCommentInstance(comment: Comment, type: InstanceType): HTMLElement source
Creates a comment in the list
Params:
Name | Type | Attribute | Description |
comment | Comment | The comment to add |
|
type | InstanceType | Where it should be added |
Return:
HTMLElement | created element |
public createLoadingInstance(message: string, type: InstanceType, animated: boolean): Object source
Creates a 'loading' instance in this comment list.
Params:
Name | Type | Attribute | Description |
message | string | what to display in box |
|
type | InstanceType | The type of instance to add |
|
animated | boolean |
|
If we should animate element |
public async createMultipleCommentInstances(comments: Comment[], type: InstanceType, animated: boolean, constructionOptions: Object): HTMLElement source
Creates a 'grouped comment' instance. i.e. group of comments. The difference between this and calling
createCommentInstance
multiple times is this will perform a proper animation of the nodes.
Params:
Name | Type | Attribute | Description |
comments | Comment[] | List of all comments |
|
type | InstanceType | Where it should be added |
|
animated | boolean |
|
If should be animated |
constructionOptions | Object | options when constructing each comment |
Return:
HTMLElement | created element |