ObservedString
ObservedString
Observable string container. Signals change via onChanged.
Kind: global class
Author: Alex Goldring
Copyright: Company Named Limited (c) 2025
- ObservedString
- new ObservedString([value])
- instance
- .onChanged :
Signal.<string, string> - .isObservedString :
boolean - .valueOf() ⇒
string - .toString() ⇒
string - .set(value) ⇒
ObservedString - .copy(other)
- .clone() ⇒
ObservedString - .getValue() ⇒
string - .process(f, [thisArg]) ⇒
this .toBinaryBuffer(buffer).fromBinaryBuffer(buffer)- .equals(other) ⇒
boolean - .hash() ⇒
number
- .onChanged :
- static
- .typeName :
string
- .typeName :
new ObservedString([value])
| Param | Type | Default |
|---|---|---|
| [value] | string | """" |
Example
const name = new ObservedString("Alice")
name.onChanged((new_name, old_name) => console.log(`Name changed from ${old_name} to ${new_name}!`));
...
name.set("Barbara"); // will print "Name changed from Alice to Barbara!" in console
name.getValue() === "Barbara"
observedString.onChanged : Signal.<string, string>
Kind: instance property of ObservedString
observedString.isObservedString : boolean
Used for optimized "instanceof" check
Kind: instance property of ObservedString
Read only: true
observedString.valueOf() ⇒ string
Kind: instance method of ObservedString
observedString.toString() ⇒ string
Kind: instance method of ObservedString
observedString.set(value) ⇒ ObservedString
Kind: instance method of ObservedString
| Param | Type |
|---|---|
| value | string |
observedString.copy(other)
Kind: instance method of ObservedString
| Param | Type |
|---|---|
| other | ObservedString |
observedString.clone() ⇒ ObservedString
Kind: instance method of ObservedString
observedString.getValue() ⇒ string
Kind: instance method of ObservedString
observedString.process(f, [thisArg]) ⇒ this
Kind: instance method of ObservedString
| Param | Type |
|---|---|
| f | function |
| [thisArg] | * |
observedString.toBinaryBuffer(buffer)
use buffer.writeUTF8String directly instead
Kind: instance method of ObservedString
| Param | Type |
|---|---|
| buffer | BinaryBuffer |
observedString.fromBinaryBuffer(buffer)
use buffer.readUTF8String directly instead
Kind: instance method of ObservedString
| Param | Type |
|---|---|
| buffer | BinaryBuffer |
observedString.equals(other) ⇒ boolean
Kind: instance method of ObservedString
| Param | Type |
|---|---|
| other | ObservedString |
observedString.hash() ⇒ number
Kind: instance method of ObservedString
ObservedString.typeName : string
Kind: static property of ObservedString
Read only: true