Hello, I am trying to bind absurd-sql (<https://gi...
# javascript
r
Hello, I am trying to bind absurd-sql (https://github.com/jlongster/absurd-sql - scroll down to "then in index.worker.js do this"). I'll attach my bindings to this thread. I'm running into an error when I try to create IndexedDBBackend: " TypeError: Class constructor k cannot be invoked without 'new'". Any ideas?
Ah, I think it's (at least partly) because his constructor takes one argument, which the instructions on the page don't specify what to do with https://github.com/jlongster/absurd-sql/blob/master/src/indexeddb/backend.js
a different version, still broken on that same constructor
t
Oh… GitHub project will be more effective
In your case you need normal external declarations
require
and
dynamic
strictly not recommended in your case
r
I did go to normal ones - check out the second attachment of IndexedDBBackend. In this case it says "worker.js:1 Uncaught (in promise) TypeError: n.IndexedDBBackend is not a constructor"
and if I try it as
external class
directly (without the object wrapping it) I get "worker.js:1 Uncaught (in promise) TypeError: n is not a constructor"
t
Uncaught (in promise) TypeError: n is not a constructor”
It looks like invalid declarations
GitHub project will be fine for sharing
r
It's not open source (yet). Check out IndexedDBBackend above vs his code here. https://github.com/jlongster/absurd-sql/blob/master/src/indexeddb/backend.js In his example usage, he passes no arguments to it, despite the constructor clearly being defined with one parameter. I'm assuming javascript doesn't care if arguments are not passed, but Kotlin does.
new IndexedDBBackend()
(his usage, per https://github.com/jlongster/absurd-sql)
If you want to try to repro, the deps are:
Copy code
implementation(npm("absurd-sql", "0.0.53"))
                implementation(npm("@jlongster/sql.js", "1.6.1"))