Home Reference Source
import {Document} from './vgui/20-document.js'
public class | source

Document

Extends:

NodeElement → Document

Represents the root node of the Element tree. This is the VguiJavascriptContext panel or a subclass.

Member Summary

Public Members
public get

Method Summary

Public Methods
public

Opens the Vgui Editor for this panel

public
public

Looks recursively in child elements to find an Element that has an matching id.

public

playSound(soundName: string)

Plays a sound effect.

public

registerBind(key: string, type: string)

Registers a binding with the client.

public

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

From class Element
public get

id: *

Returns the fieldName of the element

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.

Public Members

public get parentNode: * source

Override:

Node#parentNode

Public Methods

public activateBuildMode() source

Opens the Vgui Editor for this panel

public dispatchEvent(e: *): boolean source

Override:

Element#dispatchEvent

Params:

NameTypeAttributeDescription
e *

Return:

boolean

public getElementById(id: string): * source

Looks recursively in child elements to find an Element that has an matching id.

Params:

NameTypeAttributeDescription
id string
  • nullable: false

The id to look for

Return:

*

public playSound(soundName: string) source

Plays a sound effect. soundName be defined in the empires soundscripts.

Params:

NameTypeAttributeDescription
soundName string

The key of the sound in the soundscript to play.

public registerBind(key: string, type: string) source

Registers a binding with the client. This should trigger an immediate SettingsEvent on Document so register a listener before registering.

Params:

NameTypeAttributeDescription
key string

The key to bind to

type string

The type of the bind, can be ["int", "string", "bool", "float]

public toString(): string source

Override:

Node#toString

Return:

string