Skip to content

Settings

Type class

Base class for objects with settings, such as Entity.

More info: Settings

Sources

This information about Settings is provided for reference only and is not available through exported packages and thus should not be imported or used on its own.

Inheritance

Settings does not extend any other symbol.

Settings is extended by DataItem, Entity.

Properties

enableDispose

Type booleanDefault true

Set to false to make dispose() do nothing.

uid

Type numberDefault ++counter

A unique number, given to each object as it is created.

Methods

animate(options: AnimationOptions)

Returns Animation

Animates a setting from its current value (or from) to to. The setting jumps to from at once. With duration 0, or no value to start from, it is set to to at once and the returned animation is already stopped.

More info: Animations: animating settings

constructor(settings: ISettingsSettings)

Returns Settings

dispose()

Returns void

Disposes the object, freeing everything it holds. A disposed object can't be used again.

get(key: Key,
fallback: F
)

Returns NonNullable | F

Returns the value of setting key, or fallback if it is not set.

More info: Settings

has(key: Key)

Returns boolean

Returns true if setting key is set.

More info: Settings

isDisposed()

Returns boolean

Returns true if the object has been disposed.

off(key: Key,
callback?: undefined | (value: [""], target: this, key: Key) => void
)

Returns voidSince 5.9.2

Removes a callback added with on(). Without callback, removes all of them for key.

More info: Events: settings value change

offDebounced(key: Key,
callback?: undefined | (value: [""], target: this, key: Key) => void
)

Returns void

Removes a callback added with onDebounced(). Without callback, removes all of them for key.

More info: Events: settings value change

offDebouncedPrivate(key: Key,
callback?: undefined | (value: [""], target: this, key: Key) => void
)

Returns void

Removes a callback added with onPrivateDebounced(). Without callback, removes all of them for key.

More info: Events: settings value change

offPrivate(key: Key,
callback?: undefined | (value: [""], target: this, key: Key) => void
)

Returns voidSince 5.9.2

Removes a callback added with onPrivate(). Without callback, removes all of them for key.

More info: Events: settings value change

on(key: Key,
callback: (value: [""], target: this, key: Key) => void
)

Returns IDisposer

Calls callback each time the value of setting key changes or is removed. Setting the same value again does not call it.

More info: Events: settings value change

once(key: Key,
callback: (value: [""], target: this, key: Key) => void
)

Returns IDisposerSince 5.20.4

Like on(), but the callback is removed after it is called once.

More info: Events: settings value change

onceDebounced(key: Key,
callback: (value: [""], target: this, key: Key) => void,
debounceDelay: number
)

Returns IDisposerSince 5.20.4

Like onDebounced(), but the callback is removed after it is called once.

More info: Events: settings value change

onDebounced(key: Key,
callback: (value: [""], target: this, key: Key) => void,
debounceDelay: number
)

Returns IDisposer

Like on(), but waits until setting key has not changed for debounceDelay milliseconds, then calls callback once with the latest value.

More info: Events: settings value change

onPrivate(key: Key,
callback: (value: [""], target: this, key: Key) => void
)

Returns IDisposer

Calls callback each time the value of private setting key changes.

More info: Events: settings value change

onPrivateDebounced(key: Key,
callback: (value: [""], target: this, key: Key) => void,
debounceDelay: number
)

Returns IDisposer

Like onPrivate(), but waits until private setting key has not changed for debounceDelay milliseconds, then calls callback once with the latest value.

More info: Events: settings value change

remove(key: Key)

Returns void

Removes the value of setting key.

More info: Settings

removeAll()

Returns void

Removes all settings, as remove() does for each one.

More info: Settings

set(key: Key,
value: Value
)

Returns Value

Sets setting key to value and returns value. Stops any animation of that setting.

More info: Settings

setAll(settings: Partial)

Returns void

Sets several settings at once, from an object of key-value pairs.

More info: Settings

Events

Settings does not have any events.