Skip to content

Commit

Permalink
web: Rename Ruffle to RuffleHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinnerbone committed Jun 1, 2024
1 parent 544a39b commit d08334d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions web/packages/core/src/load-ruffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
signExtensions,
referenceTypes,
} from "wasm-feature-detect";
import type { Ruffle } from "../dist/ruffle_web";
import type { RuffleHandle } from "../dist/ruffle_web";
import { setPolyfillsOnLoad } from "./js-polyfills";
import { publicPath } from "./public-path";
import { BaseLoadOptions } from "./load-options";
Expand All @@ -36,7 +36,7 @@ type ProgressCallback = (bytesLoaded: number, bytesTotal: number) => void;
async function fetchRuffle(
config: BaseLoadOptions,
progressCallback?: ProgressCallback,
): Promise<typeof Ruffle> {
): Promise<typeof RuffleHandle> {
// Apply some pure JavaScript polyfills to prevent conflicts with external
// libraries, if needed.
setPolyfillsOnLoad();
Expand Down Expand Up @@ -66,7 +66,7 @@ async function fetchRuffle(

// Note: The argument passed to import() has to be a simple string literal,
// otherwise some bundler will get confused and won't include the module?
const { default: init, Ruffle } = await (extensionsSupported
const { default: init, RuffleHandle } = await (extensionsSupported
? import("../dist/ruffle_web-wasm_extensions")
: import("../dist/ruffle_web"));
let response;
Expand Down Expand Up @@ -114,10 +114,10 @@ async function fetchRuffle(

await init(response);

return Ruffle;
return RuffleHandle;
}

let nativeConstructor: Promise<typeof Ruffle> | null = null;
let nativeConstructor: Promise<typeof RuffleHandle> | null = null;

/**
* Obtain an instance of `Ruffle`.
Expand All @@ -135,7 +135,7 @@ export async function loadRuffle(
player: RufflePlayer,
config: BaseLoadOptions,
progressCallback?: ProgressCallback,
): Promise<Ruffle> {
): Promise<RuffleHandle> {
if (nativeConstructor === null) {
nativeConstructor = fetchRuffle(config, progressCallback);
}
Expand Down
6 changes: 3 additions & 3 deletions web/packages/core/src/ruffle-player.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Ruffle } from "../dist/ruffle_web";
import type { RuffleHandle } from "../dist/ruffle_web";
import { loadRuffle } from "./load-ruffle";
import { applyStaticStyles, ruffleShadowTemplate } from "./shadow-template";
import { lookupElement } from "./register-element";
Expand Down Expand Up @@ -165,7 +165,7 @@ export class RufflePlayer extends HTMLElement {
private loadedConfig?: URLLoadOptions | DataLoadOptions;

private swfUrl?: URL;
private instance: Ruffle | null;
private instance: RuffleHandle | null;
private lastActivePlayingState: boolean;

private _metadata: MovieMetadata | null;
Expand Down Expand Up @@ -767,7 +767,7 @@ export class RufflePlayer extends HTMLElement {
}

const actuallyUsedRendererName = this.instance!.renderer_name();
const constructor = <typeof Ruffle>this.instance!.constructor;
const constructor = <typeof RuffleHandle>this.instance!.constructor;

console.log(
"%c" +
Expand Down
6 changes: 3 additions & 3 deletions web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ struct MovieMetadata {
/// This type is exported to JS, and is used to interact with the library.
#[wasm_bindgen]
#[derive(Clone, Copy)]
pub struct Ruffle(DefaultKey);
pub struct RuffleHandle(DefaultKey);

#[wasm_bindgen]
impl Ruffle {
impl RuffleHandle {
#[allow(clippy::new_ret_no_self)]
#[wasm_bindgen(constructor)]
pub fn new(parent: HtmlElement, js_player: JavascriptPlayer, config: JsValue) -> Promise {
Expand Down Expand Up @@ -593,7 +593,7 @@ impl Ruffle {
}
}

impl Ruffle {
impl RuffleHandle {
async fn new_internal(
parent: HtmlElement,
js_player: JavascriptPlayer,
Expand Down

0 comments on commit d08334d

Please sign in to comment.