use js_sys::Object;
use wasm_bindgen::prelude::*;
use crate::Plot;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(catch, js_namespace = Plotly, js_name = newPlot)]
async fn new_plot_(id: &str, obj: &Object) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, js_namespace = Plotly, js_name = react)]
async fn react_(id: &str, obj: &Object) -> Result<JsValue, JsValue>;
}
pub async fn new_plot(id: &str, plot: &Plot) {
let plot_obj = &plot.to_js_object();
new_plot_(id, plot_obj).await.expect("Error plotting chart");
}
pub async fn react(id: &str, plot: &Plot) {
let plot_obj = &plot.to_js_object();
react_(id, plot_obj).await.expect("Error plotting chart");
}