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

# Class: ScriptPlaceholders

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

The placeholder namespaces of one runtime, and the server's, in registration order.

## Constructors

### Constructor

> **new ScriptPlaceholders**(`options`): `ScriptPlaceholders`

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

#### Parameters

##### options

[`ScriptPlaceholdersOptions`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/placeholders/index.md#scriptplaceholdersoptions)

#### Returns

`ScriptPlaceholders`

## Methods

### namespaces()

> **namespaces**(): [`PlaceholderNamespace`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/placeholders/index.md#placeholdernamespace)[]

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

Every registered namespace with its keys, oldest first.

#### Returns

[`PlaceholderNamespace`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/placeholders/index.md#placeholdernamespace)[]

***

### register()

> **register**(`owner`, `namespace`, `provider`): `number`

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

Registers a namespace for an owner.

#### Parameters

##### owner

[`PlaceholderOwner`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/placeholders/index.md#placeholderowner)

##### namespace

`string`

##### provider

[`PlaceholderProvider`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/placeholders/index.md#placeholderprovider)

#### Returns

`number`

The registration's id, which [unregister](#unregister) takes.

#### Throws

For a malformed namespace or key, or a provider without keys.

#### Throws

For a namespace that is registered already.

***

### release()

> **release**(`owner`): `void`

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

Ends every registration of an owner, as its scripts stop.

#### Parameters

##### owner

[`PlaceholderOwner`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/placeholders/index.md#placeholderowner)

#### Returns

`void`

***

### resolve()

> **resolve**(`text`, `player`): `string`

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

Renders a text: each token a registered provider answers becomes its value, and every other
token stays as written.

#### Parameters

##### text

`string`

##### player

`string` \| `undefined`

The entity id of the player the text is for, or undefined for no one.

#### Returns

`string`

***

### unregister()

> **unregister**(`id`, `owner`): `void`

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

Ends a registration, when it is the owner's. An id that is not registered is left alone.

#### Parameters

##### id

`number`

##### owner

[`PlaceholderOwner`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/placeholders/index.md#placeholderowner)

#### Returns

`void`

***

### value()

> **value**(`namespace`, `key`, `player`): `string` \| `undefined`

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

The value of one token, as text, or undefined when nobody provides it, its provider gives
no string or number, or its provider throws an error that is not fatal.

#### Parameters

##### namespace

`string`

##### key

`string`

##### player

`string` \| `undefined`

The entity id of the player the text is for, or undefined for no one.

#### Returns

`string` \| `undefined`

#### Throws

The error a resolver threw when `fatal` says it ends the render, such as the
  watchdog's; a render passes it on rather than leaving the token.
