Skip to content

Commit 197c2b1

Browse files
authored
[Feat] allow wasm caller can pass language to snapshot (#96)
1 parent 0b6d80f commit 197c2b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wasm/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ extern "C" {
1313
pub fn alert(s: &str);
1414
}
1515

16-
pub fn create_snapshot(code: &str) -> SnapshotConfig {
16+
pub fn create_snapshot(code: &str, language: String) -> SnapshotConfig {
1717
let code_content = Content::Code(
1818
CodeBuilder::default()
1919
.content(code)
20-
.language("rust")
20+
.language(language)
2121
.build()
2222
.unwrap(),
2323
);
@@ -50,10 +50,10 @@ impl Snapshot {
5050
}
5151

5252
#[wasm_bindgen]
53-
pub fn take_snapshot(code: &str) -> Snapshot {
53+
pub fn take_snapshot(code: &str, language: String) -> Snapshot {
5454
console_error_panic_hook::set_once();
5555

56-
let config = create_snapshot(code);
56+
let config = create_snapshot(code, language);
5757

5858
Snapshot::new(config)
5959
}

0 commit comments

Comments
 (0)