Skip to content

Commit

Permalink
fix: fix types of resolvers in the parameter of launch
Browse files Browse the repository at this point in the history
  • Loading branch information
arianrhodsandlot committed Jan 29, 2025
1 parent 985bdbf commit e6b980d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/src/content/docs/apis/launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,12 @@ const nostalgist = await Nostalgist.launch({
+ #### `resolveRom`
**type:** `Function`
A custom function used for resolving a ROM. The return value of this function should be a [resolvable file](/apis/resolvable-file) or an Array of [resolvable file](/apis/resolvable-file).
A custom function used for resolving a ROM. The return value of this function should be a [resolvable file](/apis/resolvable-file).
+ #### `resolveBios`
**type:** `Function`
A custom function used for resolving a BIOS. The return value of this function should be a [resolvable file](/apis/resolvable-file) or an Array of [resolvable file](/apis/resolvable-file).
A custom function used for resolving a BIOS. The return value of this function should be a [resolvable file](/apis/resolvable-file).
+ #### `resolveShader`
**type:** `Function`
Expand Down
13 changes: 4 additions & 9 deletions src/types/nostalgist-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import type { ResolvableFileInput } from '../classes/resolvable-file'
import type { RetroArchConfig } from './retroarch-config'
import type { RetroArchEmscriptenModuleOptions } from './retroarch-emscripten'

type MaybePromise<T> = Promise<T> | T

type NostalgistOptionsFiles = ResolvableFileInput | ResolvableFileInput[]

export interface NostalgistCoreDict {
Expand All @@ -18,10 +16,7 @@ export interface NostalgistCoreDict {
wasm: ResolvableFileInput
}

export type NostalgistResolveFileFunction = (
file: string,
options: NostalgistOptions,
) => MaybePromise<NostalgistOptionsFiles | undefined>
export type NostalgistResolveFileFunction = (file: string, options: NostalgistOptions) => ResolvableFileInput

export interface NostalgistOptions {
/**
Expand Down Expand Up @@ -190,13 +185,13 @@ export interface NostalgistOptions {
beforeLaunch?: (nostalgist: Nostalgist) => Promise<void> | void
onLaunch?: (nostalgist: Nostalgist) => Promise<void> | void
resolveBios: NostalgistResolveFileFunction
resolveCoreJs: (core: NostalgistOptions['core'], options: NostalgistOptions) => MaybePromise<string>
resolveCoreWasm: (core: NostalgistOptions['core'], options: NostalgistOptions) => MaybePromise<ArrayBuffer | string>
resolveCoreJs: (core: NostalgistOptions['core'], options: NostalgistOptions) => ResolvableFileInput
resolveCoreWasm: (core: NostalgistOptions['core'], options: NostalgistOptions) => ResolvableFileInput
resolveRom: NostalgistResolveFileFunction
resolveShader: (
shader: NostalgistOptions['shader'],
options: NostalgistOptions,
) => MaybePromise<NostalgistOptionsFiles | undefined>
) => ResolvableFileInput | ResolvableFileInput[]
waitForInteraction?: (params: { done: () => void }) => void
}

Expand Down

0 comments on commit e6b980d

Please sign in to comment.