-
Notifications
You must be signed in to change notification settings - Fork 159
IndexedDb onabort callback functions have parameter of type Event #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I also found a problem with : returning val value = (IDBTransaction.READ_WRITE : UndefOr[String]).getOrElse("readwrite")but hardcode : which is a detail, I decided we should wait instead of introducing js.Any return type |
|
The spec does not agree with you: |
That can't be the fault of the definition of |
|
Well, I was looking at mozilla.org, they work with Function0... I'll investigate... |
|
Sorry I meant Function0 all the time... |
|
The example on https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase.onabort uses a function that does not take any param, which effectively ignores the db.onabort = { (e: Any) =>
// don't use `e` here
} |
|
I see, I didn't know that this "ignore parameter" thingy is possible. The parameter must be of type js.Any for doing that? Why isn't it : Well the fact that they allow you doing : Is really awful, I just have to be always assuming that it is the same at a certain point in time... It's like this across the entire API |
|
It should indeed be |
|
Oki, I'll fix the commit and make it Event and then try it out. It currently really doesn't let me call tx/db.onabort nomatter what the signature is, throwing : on a simple example. I'll figure that out and push the correction. Thank you |
|
Maybe experimenting with |
|
I got it, it's the classic IDB-API-monster-screw-up problem that one doesn't know when a certain state is populated or not, for instance : val req = window.indexedDB.open(dbName)
val tx = req.transaction // this request doesn't contain transaction, returns nullbut val req = window.indexedDB.deleteDatabase(name)
val tx = req.transaction // this request does contain transactionYou simply have to always assume or investigate whether something is populated or is not, across the entire API... Or wheter to use req.onsuccess or tx.oncomplete ... brrr :-) |
4c33558 to
ea309aa
Compare
|
Btw I own IndexedDb apology for the "IDB-API-monster-screw-up" statement. It's just a classical scala vs javascript thing :-) Those transactions are implemented well from javascript developer point of view... It's not a trivial thing at all, the spec is quite big. |
|
LGTM |
IndexedDb onabort callback functions have parameter of type Event
IDBTransaction#onabort signature is incorrect, throws :
TypeError: Attempted to assign to readonly property.in runtime.
Please merge it soon, currently there is no way to even call tx.abort()... The call itself throws an error even without having tx.onabort callback registered, thank you