API reference / @jsprismarine/script-host / host/placeholders
host/placeholders
Classes
Interfaces
PlaceholderNamespace
Defined in: script-host/src/host/placeholders.ts:39
One registered namespace, as placeholders.namespaces lists it.
Properties
keys
readonlykeys: readonlystring[]
Defined in: script-host/src/host/placeholders.ts:41
namespace
readonlynamespace:string
Defined in: script-host/src/host/placeholders.ts:40
PlaceholderOwner
Defined in: script-host/src/host/placeholders.ts:19
Who registered a namespace: a pack, or the server under its own name.
Properties
name
readonlyname:string
Defined in: script-host/src/host/placeholders.ts:21
The name the content log reports a failing resolver under.
PlaceholderProvider
Defined in: script-host/src/host/placeholders.ts:25
What answers a namespace's tokens.
Properties
keys
readonlykeys: readonlystring[]
Defined in: script-host/src/host/placeholders.ts:27
The keys it answers. A token with another key stays as written.
Methods
dispose()?
optionaldispose():void
Defined in: script-host/src/host/placeholders.ts:35
Called once when the registration ends, however it ends, to free what the resolver holds.
Returns
void
resolve()
resolve(
key,player):string|number|undefined
Defined in: script-host/src/host/placeholders.ts:33
The value of one key, for the player the text is rendered for when there is one. A string or a number renders; anything else leaves the token.
Parameters
key
string
player
string | undefined
Returns
string | number | undefined
Throws
Anything: the registry leaves the token and reports the first throw per registration.
ScriptPlaceholdersOptions
Defined in: script-host/src/host/placeholders.ts:45
How the registry reports a resolver that throws, and which throws it lets through.
Properties
failed
readonlyfailed: (owner,namespace,error) =>void
Defined in: script-host/src/host/placeholders.ts:47
Told the first time a registration's resolver throws, so the log has it once per namespace.
Parameters
owner
namespace
string
error
unknown
Returns
void
fatal?
readonlyoptionalfatal?: (error) =>boolean
Defined in: script-host/src/host/placeholders.ts:49
Whether an error a resolver threw ends the render instead, such as the watchdog's.
Parameters
error
unknown
Returns
boolean
Variables
PLACEHOLDER_NAME
constPLACEHOLDER_NAME:RegExp
Defined in: script-host/src/host/placeholders.ts:10
A namespace or a key: lowercase letters, digits and underscores, starting with a letter.