@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
94 lines • 2.27 kB
TypeScript
export default ObservedString;
/**
* Observable string container.
* Signals change via {@link onChanged}.
*
* @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"
*
* @author Alex Goldring
* @copyright Company Named Limited (c) 2025
*/
declare class ObservedString extends String {
/**
*
* @param {string} [value=""]
*/
constructor(value?: string);
/**
*
* @type {string}
* @private
*/
private __value;
/**
*
* @type {Signal<string,string>}
*/
onChanged: Signal<string, string>;
/**
*
* @param {string} value
* @returns {ObservedString}
*/
set(value: string): ObservedString;
/**
*
* @param {ObservedString} other
*/
copy(other: ObservedString): void;
/**
* @return {ObservedString}
*/
clone(): ObservedString;
/**
*
* @returns {string}
*/
getValue(): string;
/**
*
* @param {function(string,string)} f
* @param {*} [thisArg]
* @returns {this}
*/
process(f: (arg0: string, arg1: string) => any, thisArg?: any): this;
/**
* @deprecated use {@link buffer.writeUTF8String} directly instead
* @param {BinaryBuffer} buffer
*/
toBinaryBuffer(buffer: BinaryBuffer): void;
/**
* @deprecated use {@link buffer.readUTF8String} directly instead
* @param {BinaryBuffer} buffer
*/
fromBinaryBuffer(buffer: BinaryBuffer): void;
/**
*
* @param {ObservedString} other
* @returns {boolean}
*/
equals(other: ObservedString): boolean;
/**
*
* @return {number}
*/
hash(): number;
/**
* Used for optimized "instanceof" check
* @readonly
* @type {boolean}
*/
readonly isObservedString: boolean;
toJSON: () => string;
fromJSON: (value: string) => ObservedString;
}
declare namespace ObservedString {
let typeName: string;
}
import Signal from "../events/signal/Signal.js";
//# sourceMappingURL=ObservedString.d.ts.map