openLix(
args
: {account?
: {id
:LixGenerated
<string
>;name
:string
; };blob?
:Blob
;keyValues?
:NewStateAll
<LixKeyValue
>[];providePlugins?
:LixPlugin
[];storage?
:LixStorageAdapter
; }):Promise
<Lix
>
Opens a Lix instance.
Creates an in-memory database by default. If a blob is provided, the database is initialized with that data. If a database is provided, uses that database directly.
Parameter | Type | Description |
---|---|---|
args | { account? : { id : LixGenerated <string >; name : string ; }; blob? : Blob ; keyValues? : NewStateAll <LixKeyValue >[]; providePlugins? : LixPlugin []; storage? : LixStorageAdapter ; } | - |
args.account? | { id : LixGenerated <string >; name : string ; } | The account that is opening this lix. Lix will automatically set the active account to the provided account. Example const account = localStorage.getItem("account") const lix = await openLix({ account }) |
args.account.id | LixGenerated <string > | - |
args.account.name | string | - |
args.blob? | Blob | Lix file data to initialize the database with. |
args.keyValues? | NewStateAll <LixKeyValue >[] | Set the key values when opening the lix. The lixcol_version_id defaults to the active version. Example const lix = await openLix({ keyValues: [{ key: "lix_sync", value: "false" }] }) |
args.providePlugins? | LixPlugin [] | Usecase are lix apps that define their own file format, like inlang (unlike a markdown, csv, or json plugin). (+) avoids separating app code from plugin code and resulting bundling logic. (-) such a file format must always be opened with the file format sdk. the file is not portable Example const lix = await openLix({ providePlugins: [myPlugin] }) |
args.storage? | LixStorageAdapter | Storage adapter for persisting lix data. Default InMemoryStorage |
Promise
<Lix
>