Wt: Wt::WGLWidget::JavaScriptVector Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Wt::WGLWidget::JavaScriptVector Class Reference

A client-side JavaScript vector. More...

`#include <WGLWidget.h>`

## Public Member Functions
| JavaScriptVector (unsigned length)
| Create a temporarily invalid JavaScriptVector.
bool | initialized () const
| Returns whether this JavaScriptVector has been initialized.
bool | hasContext () const
| Returns whether this JavaScriptVector has been assigned to a WGLWidget.
unsigned | length () const
| Returns the length (number of items) of this JavaScriptVector.
std::string | jsRef () const
| Returns the JavaScript reference to this JavaScriptVector.
std::vector< float > | value () const
| Returns the current server-side value.

## Detailed Description

A client-side JavaScript vector.

Using a JavaScriptVector, GL parameters can be modified without communication with the server. The value of the JavaScriptMatrix4x4 is updated server-side whenever an event is sent to the server.

The JavaScriptVector is represented in JavaScript as an array, either as a Float32Array or as a plain JavaScript array.

## Constructor & Destructor Documentation

## ◆ JavaScriptVector()

Wt::WGLWidget::JavaScriptVector::JavaScriptVector | ( | unsigned | length | ) |

Create a temporarily invalid JavaScriptVector.

Should be added to a WGLWidget with WGLWidget::addJavaScriptVector(), and initialized with WGLWidget::initJavaScriptVector().

## Member Function Documentation

## ◆ jsRef()

std::string Wt::WGLWidget::JavaScriptVector::jsRef | ( |  | ) | const

Returns the JavaScript reference to this JavaScriptVector.

In order to get a valid JavaScript reference, this vector should have been added to a WGLWidget.

## ◆ value()

std::vector< float > Wt::WGLWidget::JavaScriptVector::value | ( |  | ) | const

Returns the current server-side value.

Client-side changes to the JavaScriptVector are automatically synchronized.