Settings

Type class

Base class for objects with settings, such as Entity.

Click here for more info

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 Entity, DataItem.

Settings

Settings does not have any settings.

Private settings

Settings does not have any private settings.

Properties

enableDispose
#

Type boolean

Default true

Set to false to make dispose() do nothing.

uid
#

Type number

Default ++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.

Click here for more info

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.

Click here for more info

has(

key: Key

)

#

Returns boolean

Returns true if setting key is set.

Click here for more info

isDisposed()

#

Returns boolean

Returns true if the object has been disposed.

off(

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

)

#

Returns void

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

Click here for more info
@since 5.9.2

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.

Click here for more info

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.

Click here for more info

offPrivate(

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

)

#

Returns void

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

Click here for more info
@since 5.9.2

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.

Click here for more info

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.

Click here for more info

onPrivate(

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

)

#

Returns IDisposer

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

Click here for more info

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.

Click here for more info

once(

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

)

#

Returns IDisposer

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

Click here for more info
@since 5.20.4

onceDebounced(

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

)

#

Returns IDisposer

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

Click here for more info
@since 5.20.4

remove(

key: Key

)

#

Returns void

Removes the value of setting key.

Click here for more info

removeAll()

#

Returns void

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

Click here for more info

set(

key: Key,
value: Value

)

#

Returns Value

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

Click here for more info

setAll(

settings: Partial

)

#

Returns void

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

Click here for more info

Events

Settings does not have any events.