web: Make loadRuffle take in BaseLoadOptions, it doesn't need more complex than that

This commit is contained in:
Nathan Adams 2023-10-15 20:11:34 +02:00
parent feacbdc118
commit a9db2584c8
2 changed files with 5 additions and 7 deletions

View File

@ -11,7 +11,7 @@ import {
} from "wasm-feature-detect";
import { setPolyfillsOnLoad } from "./js-polyfills";
import { publicPath } from "./public-path";
import type { DataLoadOptions, URLLoadOptions } from "./load-options";
import { BaseLoadOptions } from "./load-options";
declare global {
let __webpack_public_path__: string;
@ -32,7 +32,7 @@ type ProgressCallback = (bytesLoaded: number, bytesTotal: number) => void;
* instances.
*/
async function fetchRuffle(
config: URLLoadOptions | DataLoadOptions | object,
config: BaseLoadOptions,
progressCallback?: ProgressCallback,
): Promise<typeof Ruffle> {
// Apply some pure JavaScript polyfills to prevent conflicts with external
@ -128,7 +128,7 @@ let lastLoaded: Promise<Ruffle> | null = null;
* instances.
*/
export function loadRuffle(
config: URLLoadOptions | DataLoadOptions | object,
config: BaseLoadOptions,
progressCallback?: ProgressCallback,
): Promise<Ruffle> {
if (lastLoaded === null) {

View File

@ -1,4 +1,4 @@
import type { DataLoadOptions, URLLoadOptions } from "./load-options";
import { BaseLoadOptions } from "./load-options";
import { currentScriptURL, isExtension } from "./current-script";
/**
@ -18,9 +18,7 @@ import { currentScriptURL, isExtension } from "./current-script";
* @param config The `window.RufflePlayer.config` object.
* @returns The public path for the given source.
*/
export function publicPath(
config: URLLoadOptions | DataLoadOptions | object,
): string {
export function publicPath(config: BaseLoadOptions): string {
// Default to the directory where this script resides.
let path = currentScriptURL?.href ?? "";
if (