ssbc / ssb-db2

A new database for secure-scuttlebutt
47 stars 8 forks source link

document — "Run in the browser" #278

Closed nichoth closed 2 years ago

nichoth commented 2 years ago

The readme mentions

Run in the browser

But i didn't see any other mention of this. What is the lower level API that this uses? (for example indexedDB). How does replication work in this case? If your follow graph is too large to store the entire thing in browser-based storage, how do you decide what to store?

arj03 commented 2 years ago

Check https://github.com/arj03/ssb-browser-core, I'll be merging https://github.com/arj03/ssb-browser-core/pull/59 soon that makes the API 1 to 1 with node. Happy to merge a PR that improves the README in this regard with a link?

nichoth commented 2 years ago

Ok, so https://github.com/arj03/ssb-browser-core uses ssb-db2, and you would use the browser-core module in a browser. I see.

nichoth commented 2 years ago

I see the browser-core example is called like:

ssbSingleton.setup("/.ssb-example", config, extraModules)

What does /.ssb-example refer to in a browser?

arj03 commented 2 years ago

It's just like a namespace in case you have multiple databases. When running in chrome it will actually write files to a folder under that name.

nichoth commented 2 years ago

thanks