Skip to content

API reference / @jsprismarine/script-host / shape/implementations / ScriptApiImplementations

Class: ScriptApiImplementations ​

Defined in: script-host/src/shape/implementations.ts:107

The behavior written for Script API members, by module, class and member. A member with no entry is still present in every script that resolves to a version with it, and throws NotImplementedError when used.

Constructors ​

Constructor ​

new ScriptApiImplementations(): ScriptApiImplementations

Returns ​

ScriptApiImplementations

Methods ​

converts() ​

converts(module, owner, member): readonly string[]

Defined in: script-host/src/shape/implementations.ts:135

The arguments a member's implementation converts itself; see ImplementationOptions.converts.

Parameters ​

module ​

string

owner ​

string

member ​

string

Returns ​

readonly string[]


find() ​

find(module, owner, member): Implementation | undefined

Defined in: script-host/src/shape/implementations.ts:140

Finds a member's behavior.

Parameters ​

module ​

string

owner ​

string

member ​

string

Returns ​

Implementation | undefined


implement() ​

implement<Module, Owner, Member>(module, owner, member, implementation, options?): this

Defined in: script-host/src/shape/implementations.ts:116

Registers one member's behavior. The generated ScriptApiMembers types the names and the implementation's form, so a member the metadata does not have does not compile.

Type Parameters ​

Module ​

Module extends keyof ScriptApiMembers

Owner ​

Owner extends string

Member ​

Member extends string

Parameters ​

module ​

Module

owner ​

Owner

member ​

Member

implementation ​

ImplementationOf<ScriptApiMembers[Module][Owner][Member]>

options? ​

ImplementationOptions = {}

Returns ​

this

Throws ​

When the member already has one.