You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
}
};
The text was updated successfully, but these errors were encountered:
indexeddb is quite complicated. Everything is done async via. callbacks, so you need to use Closure, but the memory management is fiddly. Eventually there will be a futures-based lib in https://github.com/rustwasm/gloo, in the mean time it's just gonna be hard.
Thanks for the question @bigfish3000! I agree with @derekdreery in that this is pretty complicated, but targeted to be covered by the gloo project! In light of that I'm gonna close this in favor of rustwasm/gloo#68
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:
The text was updated successfully, but these errors were encountered: