From e417073b0d8ee3a5876fb67c80adbc2fa530b63e Mon Sep 17 00:00:00 2001 From: rav4s Date: Wed, 31 Mar 2021 17:09:07 -0500 Subject: [PATCH] Pass input to wasm function --- src/lib.rs | 6 +++--- www/app.js | 2 +- www/index.html | 1 - www/package-lock.json | 1 + 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 08e6795..3dfb584 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -153,11 +153,11 @@ pub fn translation(inter_codons: Vec) -> Vec { } #[wasm_bindgen] -pub fn main() { +pub fn main(mut strand: String) { println!("Enter the DNA strand to be transcribed and translated: "); - let mut strand: String = "TACATGCCATACGAGACGAGCGCGCCTAAGCGGCGCAGACTCATGGTCATT".to_string(); - strand = strand.to_uppercase(); + //let mut strand: String = "TACATGCCATACGAGACGAGCGCGCCTAAGCGGCGCAGACTCATGGTCATT".to_string(); + strand = strand.to_string().to_uppercase(); let messenger_rna = transcription(strand); println!("The transcribed strand is: {}", messenger_rna); diff --git a/www/app.js b/www/app.js index 1e76d02..b41e838 100644 --- a/www/app.js +++ b/www/app.js @@ -5,4 +5,4 @@ const strand = urlParams.get('strand'); console.log(strand) -wasm.main(); +wasm.main(strand); diff --git a/www/index.html b/www/index.html index 49097f7..0a70b97 100644 --- a/www/index.html +++ b/www/index.html @@ -6,7 +6,6 @@ -

Please enter the DNA strand in the space below:

diff --git a/www/package-lock.json b/www/package-lock.json index 234f8ad..cb2f21f 100644 --- a/www/package-lock.json +++ b/www/package-lock.json @@ -23,6 +23,7 @@ } }, "../pkg": { + "name": "wasm-dna-transcription-translation", "version": "0.1.0" }, "node_modules/@types/events": {