[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/script-host](https://jsprismarine.dev/api/@jsprismarine/script-host/index.md) / host/placeholders

# host/placeholders

## Classes

- [ScriptPlaceholders](https://jsprismarine.dev/api/@jsprismarine/script-host/host/placeholders/classes/ScriptPlaceholders.md)

## Interfaces

### PlaceholderNamespace

Defined in: [script-host/src/host/placeholders.ts:39](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L39)

One registered namespace, as `placeholders.namespaces` lists it.

#### Properties

##### keys

> `readonly` **keys**: readonly `string`[]

Defined in: [script-host/src/host/placeholders.ts:41](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L41)

##### namespace

> `readonly` **namespace**: `string`

Defined in: [script-host/src/host/placeholders.ts:40](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L40)

***

### PlaceholderOwner

Defined in: [script-host/src/host/placeholders.ts:19](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L19)

Who registered a namespace: a pack, or the server under its own name.

#### Properties

##### name

> `readonly` **name**: `string`

Defined in: [script-host/src/host/placeholders.ts:21](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L21)

The name the content log reports a failing resolver under.

***

### PlaceholderProvider

Defined in: [script-host/src/host/placeholders.ts:25](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L25)

What answers a namespace's tokens.

#### Properties

##### keys

> `readonly` **keys**: readonly `string`[]

Defined in: [script-host/src/host/placeholders.ts:27](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L27)

The keys it answers. A token with another key stays as written.

#### Methods

##### dispose()?

> `optional` **dispose**(): `void`

Defined in: [script-host/src/host/placeholders.ts:35](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L35)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L33)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L45)

How the registry reports a resolver that throws, and which throws it lets through.

#### Properties

##### failed

> `readonly` **failed**: (`owner`, `namespace`, `error`) => `void`

Defined in: [script-host/src/host/placeholders.ts:47](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L47)

Told the first time a registration's resolver throws, so the log has it once per namespace.

###### Parameters

###### owner

[`PlaceholderOwner`](#placeholderowner)

###### namespace

`string`

###### error

`unknown`

###### Returns

`void`

##### fatal?

> `readonly` `optional` **fatal?**: (`error`) => `boolean`

Defined in: [script-host/src/host/placeholders.ts:49](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L49)

Whether an error a resolver threw ends the render instead, such as the watchdog's.

###### Parameters

###### error

`unknown`

###### Returns

`boolean`

## Variables

### PLACEHOLDER\_NAME

> `const` **PLACEHOLDER\_NAME**: `RegExp`

Defined in: [script-host/src/host/placeholders.ts:10](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/host/placeholders.ts#L10)

A namespace or a key: lowercase letters, digits and underscores, starting with a letter.
