Home Reference Source
import {Element} from './vgui/15-element.js'
public class | source

Element

Extends:

Node → Element

Direct Subclass:

Document, JsChild, Panel

Represents an element in the res file

Constructor Summary

Public Constructor
public

constructor(id: *)

Member Summary

Public Members
public get

id: *

Returns the fieldName of the element

Method Summary

Public Methods
public

addEventListener(type: *, listener: *)

Adds a listener to a type of events See Event for subclasses for supported types

public

dispatchEvent(event: *): *

Dispatch an event on this element.

public

getAttribute(name: *): *

Gets an attribute on the element In order to support a new attribute an overloading class needs to add the setting type to _attrHandler

public

removeEventListener(type: *, listener: *)

Removes a registered event listener

public

setAttribute(name: *, value: *)

Sets an attribute on the element In order to support a new attribute an overloading class needs to add the setting type to _attrHandler

public

startAnimation(animationName: string): bool

Starts a VGUI animation on child elements.

Inherited Summary

From class Node
public get

Returns the children of this node

public get

Returns a Node that is the parent of this node.

public

toString(): *

Returns a string representation of the Node

Public Constructors

public constructor(id: *) source

Override:

Node#constructor

Params:

NameTypeAttributeDescription
id *

Public Members

public get id: * source

Returns the fieldName of the element

Public Methods

public addEventListener(type: *, listener: *) source

Adds a listener to a type of events See Event for subclasses for supported types

Params:

NameTypeAttributeDescription
type *
listener *

public dispatchEvent(event: *): * source

Dispatch an event on this element. The event will bubble up until document unless a handler calls stopPropagation

Params:

NameTypeAttributeDescription
event *

Return:

*

public getAttribute(name: *): * source

Gets an attribute on the element In order to support a new attribute an overloading class needs to add the setting type to _attrHandler

Params:

NameTypeAttributeDescription
name *

Return:

*

public removeEventListener(type: *, listener: *) source

Removes a registered event listener

Params:

NameTypeAttributeDescription
type *
listener *

public setAttribute(name: *, value: *) source

Sets an attribute on the element In order to support a new attribute an overloading class needs to add the setting type to _attrHandler

Params:

NameTypeAttributeDescription
name *
value *

public startAnimation(animationName: string): bool source

Starts a VGUI animation on child elements. See https://developer.valvesoftware.com/wiki/Understanding_VGUI2_Animation for information about defining animations.

Params:

NameTypeAttributeDescription
animationName string

The name of the animation to start.

Return:

bool

True if animation was started succesfully