Closed
Description
How to use the indexed via web-sys, do some one have examples ?
Who can show me the examples?
I can not access the indexed_db like this:
let db = window!().indexed_db().unwrap().unwrap();
let opened_request = match db.open("test-my") {
Ok(v) => { v },
Err(res) => {
let s = Array::from(&res);
console::log(&s);
return;
}
};
let trans = match opened_request.transaction() {
Some(v) => { v },
None => {
log_info_str!("Can not get transaction"); //It always show me error!
return;
}
};
let db = trans.db();
let store = match db.create_object_store("my-test") {
Ok(v) => { v },
Err(err) => {
let s = Array::from(&err);
console::log(&s);
return;
}
};
let js = JsValue::from("hello world");
let _request = match store.put(&js) {
Ok(v) => { v },
Err(err) => {
let s = Array::from(&err);
console::log(&s);
return;
}
};