diff --git a/html/worker.js b/html/worker.js
index 95a96eb..fe4daeb 100644
--- a/html/worker.js
+++ b/html/worker.js
@@ -64,13 +64,7 @@ onmessage = function(evt) {
// Step election
state = wasm['CountState' + numbers].new(election);
- wasm['count_init_' + numbers](state, opts);
-
- postMessage({'type': 'updateResultsTable', 'result': wasm['update_results_table_' + numbers](1, state, opts, reportStyle)});
- postMessage({'type': 'updateStageComments', 'comment': wasm['update_stage_comments_' + numbers](state)});
-
- stageNum = 2;
-
+ stageNum = 1;
resumeCount();
} else if (evt.data.type == 'userInput') {
@@ -92,7 +86,12 @@ onmessage = function(evt) {
function resumeCount() {
for (;; stageNum++) {
- let isDone = wasm['count_one_stage_' + numbers](state, opts);
+ let isDone;
+ if (stageNum <= 1) {
+ isDone = wasm['count_init_' + numbers](state, opts);
+ } else {
+ isDone = wasm['count_one_stage_' + numbers](state, opts);
+ }
if (wasmRaw.asyncify_get_state() !== 0) {
// This stage caused a stack unwind in get_user_input so ignore the result
diff --git a/src/stv/gregory/transfers.rs b/src/stv/gregory/transfers.rs
index 88338af..6eb5d52 100644
--- a/src/stv/gregory/transfers.rs
+++ b/src/stv/gregory/transfers.rs
@@ -455,7 +455,13 @@ impl<'e, N: Number> TransferTable<'e, N> {
}
/// Render table as plain text
- //#[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_arch = "wasm32"))]
+ pub fn render_text(&self, opts: &STVOptions) -> String {
+ return self.render(opts).to_string();
+ }
+
+ /// Render table as HTML
+ #[cfg(target_arch = "wasm32")]
pub fn render_text(&self, opts: &STVOptions) -> String {
return self.render(opts).to_html();
}