React Native's JSI Explained · Part 2 · Setting up a JSI module
Вставка
- Опубліковано 21 вер 2021
- Welcome to React Native JSI explained, on this video we will start setting up an actual JSI module, today we will start with a old-bridge C++ library and then slowly migrate to a JSI implementation
ADDITIONAL RESOURCES
My personal website: ospfranco.com
C++ Guide on UA-cam: • C++ For JavaScript Dev...
JSI/C++ Guide written version: ospfranco.gumroad.com/l/IeeIvl
Follow me on twitter: / ospfranco - Наука та технологія
Hi Oscar
Great series! Thanks a lot!
Kindly please explain various function definitions in SuperSqllite.mm file and why we need to write such functions and what is the purpose of each one ?
Like why we do need to cast bridge ?
What does installSequel does?
thanks
Is codegen for typescript already stable enough?
stable, don't think so, some libraries might be using it though
This example and all similar "hello world" or "add a and b" examples install JSI functions from under setBridge. But that's pretty misleading. There is threading/race involved and there is no guarantee that cxxBridge.runtime will be there when setBridge is called. It never is for me.
The most reliable way to make sure the runtime is there is to:
1. store bridge in setBridge
2. grab cxxBridge.runtime when RCTBridgeModule's startObserving is called. But that time you are guaranteed that native/JS bridge has been set up and the runtime was set.
You are right, but this video/tutorial is by now fairly outdated (at the time turbo modules where not even usable). The best way to do it IMO is to call a sync blocking method and call it whenever the library is imported. No need to mess around with more internal calls. My libraries are updated and you can take a look into the open source repos.
@@ospfranco ahh, and that blocking code is executed when your .jsbundle is loaded? Brilliant, thanks!