Skip to content

Commit

Permalink
feature-flag for wasm-bindgen
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Feb 3, 2025
1 parent 40178da commit 9b2e91b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ xmlparser = { version = "0.13.6", default-features = false }
serde = { version = "1" }
serde_derive = { version = "1" }
serde_json = { version = "1" }
wasm-bindgen = { version = "0.2" }
wasm-bindgen = { version = "0.2", optional = true }
base64 = "0.22.1"
flate2 = "1.0.35"

Expand All @@ -48,6 +48,7 @@ debug = true

[features]
default = ["js-sys"]
wasm = ["wasm-bindgen"]
gif = ["image/gif"]
jpeg = ["image/jpeg"]
png = ["image/png"]
Expand All @@ -61,7 +62,7 @@ dds = ["image/dds"]
webp = ["image/webp"]
woff2 = ["allsorts/brotli", "azul-text-layout/woff2"]
rayon = ["image/rayon"] # enables multithreading for decoding images
js-sys = ["dep:js-sys"] # enables js-sys features on wasm
js-sys = ["dep:js-sys", "wasm"] # enables js-sys features on wasm

[package.metadata.docs.rs]
all-features = true
Expand Down
1 change: 1 addition & 0 deletions src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct PrintPdfApiReturn {
pub error: String,
}

#[cfg(feature = "wasm")]
#[allow(non_snake_case)]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn PrintPdfFromXml(input: String) -> String {
Expand Down

0 comments on commit 9b2e91b

Please sign in to comment.