refactor: ref docs

This commit is contained in:
0xSage 2023-10-27 11:36:40 +07:00
parent b51bb9845c
commit 0d824fb203
9 changed files with 82 additions and 25 deletions

View File

@ -0,0 +1,47 @@
---
title: "init"
---
`init` is the main entrypoint for mounting your application and its custom logic. It is a reserved function that Jan will look for to initialize your application.
## Usage
```js
// javascript
const core = require("@janhq/core");
// typescript
import * as core from "@janhq/core";
```
## init
TODO
## RegisterExtensionPoint
`RegisterExtensionPoint` is used for app initialization.
It lets you register functions/methods with the main application.
```js
import { RegisterExtensionPoint } from "@janhq/core";
```
```js
type RegisterExtensionPoint = (
extensionName: string,
extensionId: string,
method: Function,
priority?: number
)
```
## invokePluginFunc
```js
// index.ts
function foo(id: number) {
return core.invokePluginFunc(MODULE_PATH, "getConvMessages", id);
}
```

View File

@ -1,5 +1,4 @@
---
sidebar_position: 1
title: "CoreService"
---

View File

@ -1,5 +1,4 @@
---
sidebar_position: 2
title: "events"
---

View File

@ -0,0 +1,15 @@
---
title: "store"
---
`store` is a helper object for working with Jan app's local storage database.
By default, Jan ships with a [pouchDB](https://pouchdb.com/) client side noSQL db to persist usage state.
_Note: default `store` logic is from [@data-plugin](https://www.npmjs.com/package/@janhq/data-plugin) which implements `StoreService`._
## Usage
```js
import { store } from "@janhq/core";
```

View File

@ -1,5 +1,4 @@
---
sidebar_position: 5
title: "filesystem"
---

View File

@ -0,0 +1,19 @@
---
title: "preferences"
---
`preferences` is a helper object for adding settings fields to your apps.
## Usage
```js
todo;
```
## registerPreferences
## get
## set
## clear

View File

@ -1,6 +0,0 @@
---
sidebar_position: 4
title: "preferences"
---
## Usage

View File

@ -1,15 +0,0 @@
---
sidebar_position: 3
title: "store"
---
`store` is a helper library for working with Jan app's local storage database.
Jan ships with a [pouchDB](https://pouchdb.com/) client side noSQL db to persist usage state
store (logic from @data-plugin which implements StoreService)
## Usage
```js
import { store } from "@janhq/core";
```

View File

@ -63,7 +63,7 @@ const sidebars = {
type: "category",
label: "Reference",
collapsible: true,
collapsed: false,
collapsed: true,
items: [
{
type: "autogenerated",