web: Make PublicAPI use Config

This commit is contained in:
Nathan Adams 2020-11-17 22:05:25 +01:00 committed by Mike Welsh
parent 96d3c30b5e
commit f4a710c806
2 changed files with 15 additions and 2 deletions

View File

@ -15,4 +15,15 @@ export interface Config {
* with this field being a fallback.
*/
public_path?: string;
/**
* Whether or not to enable polyfills on the page.
*
* Polyfills will look for "legacy" flash content like `<object>`
* and `<embed>` elements, and replace them with compatible
* Ruffle elements.
*
* @default true
*/
polyfills?: boolean;
}

View File

@ -1,6 +1,7 @@
import { Version } from "./version";
import { VersionRange } from "./version-range";
import { SourceAPI } from "./source-api";
import { Config } from "./config";
/**
* Represents the Ruffle public API.
@ -15,10 +16,10 @@ import { SourceAPI } from "./source-api";
*/
export class PublicAPI {
private sources: Record<string, SourceAPI>;
private config: any;
private config: Config;
private invoked: boolean;
private newest_name: string | null;
private conflict: any;
private conflict: Record<string, unknown> | null;
/**
* Construct the Ruffle public API.
@ -42,6 +43,7 @@ export class PublicAPI {
this.config = {};
this.invoked = false;
this.newest_name = null;
this.conflict = null;
if (prev !== undefined && prev !== null) {
if (prev.constructor.name === PublicAPI.name) {