javascript constructor

This commit is contained in:
Magnus Ulimoen 2019-12-08 20:55:47 +01:00
parent a473b78756
commit a0a125b61c
2 changed files with 2 additions and 1 deletions

View File

@ -148,7 +148,7 @@ async function run() {
const width = 40;
const height = 50;
const universe = Universe.new(width, height);
const universe = new Universe(width, height);
const TIMEFACTOR = 10000.0;
const MAX_DT = 2.0/Math.max(width, height);

View File

@ -22,6 +22,7 @@ pub struct Universe {
#[wasm_bindgen]
impl Universe {
#[wasm_bindgen(constructor)]
pub fn new(width: u32, height: u32) -> Self {
Self {
sys: (System::new(width, height), System::new(width, height)),