Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of temp:// Asset Source #13406

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,17 @@ description = "Demonstrates how to wait for multiple assets to be loaded."
category = "Assets"
wasm = true

[[example]]
name = "temp_asset"
path = "examples/asset/temp_asset.rs"
doc-scrape-examples = true

[package.metadata.example.temp_asset]
name = "Temporary assets"
description = "How to use the temporary asset source"
category = "Assets"
wasm = true

# Async Tasks
[[example]]
name = "async_compute"
Expand Down
11 changes: 11 additions & 0 deletions crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,23 @@ web-sys = { version = "0.3", features = [
"Window",
"Response",
"WorkerGlobalScope",
"Navigator",
"StorageManager",
"FileSystemFileHandle",
"FileSystemDirectoryHandle",
"FileSystemGetDirectoryOptions",
"FileSystemGetFileOptions",
"File",
"FileSystemWritableFileStream",
"FileSystemRemoveOptions",
] }
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
async-channel = "2.2.0"

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

[dev-dependencies]
bevy_core = { path = "../bevy_core", version = "0.14.0-dev" }
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_asset/src/io/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ use wasm_bindgen::{prelude::wasm_bindgen, JsCast, JsValue};
use wasm_bindgen_futures::JsFuture;
use web_sys::Response;

mod web_file_system;

pub use web_file_system::*;

/// Represents the global object in the JavaScript context
#[wasm_bindgen]
extern "C" {
Expand Down