A quick question about the polyfill for non-browser environment

9 views
Skip to first unread message

Yang Lei

unread,
Aug 12, 2025, 11:58:53 AMAug 12
to Tinode General
Hi,

I am going to make the Tinode Javascript SDK work on React Native.
Websocket and XMLHttpRequest is supported by default, the only missing part is Indexeddb.

Do I need to do the following to make the cache work on React Native as well?

1. rewrite the db.js with alternative on React Native (Let's say Expo Sqlite with Drizzle ORM) while maintaining the same methods , which makes the new db.js works with other js, and then bundle all the js files with the React Native/Expo project.

I am just trying to know if I am on the right way.

I didn't find a description about the database/tables about the cache, please let me know if there is one.

I am trying to dig it out from the db.js since it is not to much code.

Thanks.

Best regards!
Yang 

Gene

unread,
Aug 12, 2025, 1:38:55 PMAug 12
to Tinode General
On Tuesday, August 12, 2025 at 6:58:53 PM UTC+3 Yang Lei wrote:
Hi,

I am going to make the Tinode Javascript SDK work on React Native.
Websocket and XMLHttpRequest is supported by default, the only missing part is Indexeddb.

Do I need to do the following to make the cache work on React Native as well?

1. rewrite the db.js with alternative on React Native (Let's say Expo Sqlite with Drizzle ORM) while maintaining the same methods , which makes the new db.js works with other js, and then bundle all the js files with the React Native/Expo project.

I have no experience with React Native or the tools you listed. 

You might find it easier to keep the existing interface and use a drop-in replacement, such as https://github.com/indexeddbshim/IndexedDBShim
Reply all
Reply to author
Forward
0 new messages