In the Browser
How to use TyDB in the browser (with demo)
Installation and usage
Directly including TyDB in a script tag
<script src="//raw.githack.com/alexcorvi/tydb/master/dist/index.browser.js"></script>
Using a module bundler & package manager
Install TyDB using npm
npm i tydb
or using yarn
yarn add tydb
Memory only
Similar to when running in NodeJS, if you instantiate the database with no persistence adapter, data will not be persisted and will live in memory only.
const db = new tydb.Database({
ref: "mydb",
model: MyModel
});
Using IndexedDB Adapter
const db = new tydb.Database({
ref: "mydb",
model: MyModel,
persistence_adapter: tydb.IDB_Persistence_Adapter
});
Connecting to a remote instance
const db = new tydb.Database({
ref: "tydb://http://example.com/mydb",
model: MyModel,
});
Similar to when running in NodeJS environment, the instance in this case will be nothing more than a shell that sends arguments and receive data.
Last updated
Was this helpful?