-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Refactor connection to it's own Host Object #77
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! You are on the right path @lcjuanpa. You probably already modified the cmakelists.txt
on your own machine, but please also put it in this branch so CI can compile your code automatically.
cpp/OpenSqliteHo.h
Outdated
|
||
namespace opsqlite { | ||
|
||
class JSI_EXPORT OpenSqliteHo : public facebook::jsi::HostObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to DbHostObject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the namespace jsi = facebook::jsi
to avoid long lines
cpp/OpenSqliteHo.cpp
Outdated
|
||
jsi::Function OpenSqliteHo::open(jsi::Runtime &rt, | ||
const std::string &basePath) { | ||
return HOSTFN("open", 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you still need some help: You are kinda on the right path, but this is not quite correct. You need the get
, set
and getPropertyNames
function for the HostObject to work. If you want to declare further internal functions, there is no need to return a HOSTFN. You can declare the HOSTFNs on the header file as std::function
though, that would be a cool optimization actually.
cpp/OpenSqliteHo.cpp
Outdated
return location; | ||
} | ||
|
||
string OpenSqliteHo::getEncryptionKey(jsi::Runtime &rt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you really want to go this way, I would suggest to make this generic, being able to retrieve any key from the object. Put it in utils.h though.
Suggested changes applied on new commit |
Don't close this PR, we will use it to merge it to main |
No description provided.