web: Add maxExecutionDuration to Config (close #1773)

This commit is contained in:
Ben Lubar 2021-02-12 02:42:31 -06:00 committed by Mike Welsh
parent b93e556f89
commit ca5cf0553f
1 changed files with 6 additions and 0 deletions

View File

@ -35,6 +35,7 @@ use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::sync::Once;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use std::{cell::RefCell, error::Error, num::NonZeroI32};
use wasm_bindgen::{prelude::*, JsCast, JsValue};
use web_sys::{
@ -136,6 +137,9 @@ pub struct Config {
#[serde(rename = "logLevel")]
log_level: log::Level,
#[serde(rename = "maxExecutionDuration")]
max_execution_duration: Duration,
}
impl Default for Config {
@ -147,6 +151,7 @@ impl Default for Config {
upgrade_to_https: true,
warn_on_unsupported_content: true,
log_level: log::Level::Error,
max_execution_duration: Duration::from_secs(15),
}
}
}
@ -470,6 +475,7 @@ impl Ruffle {
}
core.set_letterbox(config.letterbox);
core.set_warn_on_unsupported_content(config.warn_on_unsupported_content);
core.set_max_execution_duration(config.max_execution_duration);
}
// Create instance.