Skip to content

Commit 4a6b538

Browse files
committed
WIP: WASM Support
Initial support for WASM `temp://` using OPFS.
1 parent c47df24 commit 4a6b538

File tree

7 files changed

+774
-65
lines changed

7 files changed

+774
-65
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ doc-scrape-examples = true
14461446
name = "Temporary assets"
14471447
description = "How to use the temporary asset source"
14481448
category = "Assets"
1449-
wasm = false
1449+
wasm = true
14501450

14511451
# Async Tasks
14521452
[[example]]

crates/bevy_asset/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,19 @@ web-sys = { version = "0.3", features = [
5151
"Window",
5252
"Response",
5353
"WorkerGlobalScope",
54+
"Navigator",
55+
"StorageManager",
56+
"FileSystemFileHandle",
57+
"FileSystemDirectoryHandle",
58+
"FileSystemGetDirectoryOptions",
59+
"FileSystemGetFileOptions",
60+
"File",
61+
"FileSystemWritableFileStream",
62+
"FileSystemRemoveOptions",
5463
] }
5564
wasm-bindgen-futures = "0.4"
5665
js-sys = "0.3"
66+
async-channel = "2.2.0"
5767

5868
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
5969
notify-debouncer-full = { version = "0.3.1", optional = true }

crates/bevy_asset/src/io/wasm.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ use wasm_bindgen::{prelude::wasm_bindgen, JsCast, JsValue};
88
use wasm_bindgen_futures::JsFuture;
99
use web_sys::Response;
1010

11+
mod opfs;
12+
13+
pub use opfs::*;
14+
1115
/// Represents the global object in the JavaScript context
1216
#[wasm_bindgen]
1317
extern "C" {

0 commit comments

Comments
 (0)