Skip to content

Commit

Permalink
docs: update docs for blocklet sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
linchen1987 committed Aug 15, 2023
1 parent b3d35eb commit 344d66b
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.136 (August 15, 2023)

- docs: update docs for blocklet sdk

## 0.1.135 (July 20, 2023)

- docs: update docs for "Blocklet Component"
Expand Down
2 changes: 1 addition & 1 deletion developer/docs/blocklet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository:
type: git
url: git+https://github.com/blocklet/blocklet-site.git
specVersion: 1.2.8
version: 0.1.135
version: 0.1.136
logo: logo.png
files:
- hooks/post-start.js
Expand Down
22 changes: 18 additions & 4 deletions developer/docs/pages/reference/blocklet-sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,11 @@ const {
appName, // the title of the app, used to display to user
appDescription, // the description of the app
appUrl, // the web url of the app
appStorageEndpoint // the endpoint of the DID Spaces of the app
componentDid, // the did of the blocklet
dataDir, // the data dir of the blocklet
cacheDir, // the cache dir of the blocklet
mode, // in which mode the blocklet is running
appStorageEndpoint // the endpoint of the DID Spaces of the app
serverVersion: // the version of the server where the app is running
preferences, // blocklet preferences. default: {}
} = env;
Expand All @@ -511,10 +512,10 @@ env.mode === 'production'; // The blocklet is running in the production mode

## Config

Unlike Environment, the information in Config will be updated in real time, and the application does not need to be restarted
Unlike Environment, the information in Config will be updated in real time, the application does not need to be restarted, and events will be thrown when updating

```javascript
import { env, components } from '@blocklet/config'
import { env, components, events, Events } from '@blocklet/config'
```

- `env` same as env in Environment
Expand All @@ -524,20 +525,33 @@ import { env, components } from '@blocklet/config'
- `appName` the title of the app, used to display to user
- `appDescription` the description of the app
- `appUrl` the web url of the app
- `appStorageEndpoint` the endpoint of the DID Spaces of the app
- `componentDid` 组件 DID
- `dataDir` the data dir of the blocklet
- `cacheDir` the cache dir of the blocklet
- `mode` in which mode the blocklet is running
- `appStorageEndpoint` the endpoint of the DID Spaces of the app
- `serverVersion` the version of the server where the app is running
- `preferences` blocklet preferences. default: {}
- `components` **Array\<object\>**
- `title` component title
- `did` component did
- `name` component name
- `version` component version
- `mountPoint` e.g. '/', '/blog'
- `status` **import(@blocklet/constant).BlockletStatus**
- `port` e.g. 5678
- `webEndpoint` e.g. http://127.0.0.1:5678
- `resources` **Array\<string\>** component resource path

```typescript
events.on(Events.componentAdded, (components) => {});
events.on(Events.componentRemoved, (components) => {});
events.on(Events.componentStarted, (components) => {});
events.on(Events.componentStopped, (components) => {});
events.on(Events.componentUpdated, (components) => {});

events.on(Events.envUpdate, (envs: {key: string; value: string}[]) => {});
```

## Component

Expand Down
20 changes: 17 additions & 3 deletions developer/docs/pages/reference/blocklet-sdk/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,11 @@ const {
appName, // 应用名称,用于显示给用户
appDescription, // 应用描述,用于显示给用户
appUrl, // 应用的的访问地址
appStorageEndpoint // 应用绑定的 DID Space 的 endpoint
componentDid, // 组件 DID
dataDir, // 组件 数据存放目录
cacheDir, // 组件 缓存数据路径
mode, // 组件 以什么模式运行
appStorageEndpoint // 应用绑定的 DID Space 的 endpoint
serverVersion: // 应用运行所在server的版本
preferences, // 应用的偏好设置。默认值: {}
} = env;
Expand All @@ -511,7 +512,7 @@ env.mode === 'production'; // Blocklet 以正式模式运行

## Config

和 Environment 不用的是 Config 中的信息会实时更新,应用无需重启
和 Environment 不同的是 Config 中的信息会实时更新,应用无需重启,且更新时会抛出事件

```javascript
import { env, components } from '@blocklet/config'
Expand All @@ -524,20 +525,33 @@ import { env, components } from '@blocklet/config'
- `appName` 应用名称,用于显示给用户
- `appDescription` 应用描述,用于显示给用户
- `appUrl` 应用的的访问地址
- `appStorageEndpoint` 应用绑定的 DID Space 的 endpoint
- `componentDid` 组件 DID
- `dataDir` Blocklet 数据存放目录
- `cacheDir` Blocklet 缓存数据路径
- `mode` Blocklet 以什么模式运行
- `appStorageEndpoint` 应用绑定的 DID Space 的 endpoint
- `serverVersion` 应用运行所在server的版本
- `preferences` 应用 的偏好设置。默认值: {}
- `components` **Array\<object\>**
- `title` 组件名称
- `did` 组件 DID
- `name` 组件 name
- `version` 组件版本
- `mountPoint` e.g. '/', '/blog'
- `status` **import(@blocklet/constant).BlockletStatus**
- `port` e.g. 5678
- `webEndpoint` e.g. http://127.0.0.1:5678
- `resources` **Array\<string\>** 组件的资源路径

```typescript
events.on(Events.componentAdded, (components) => {});
events.on(Events.componentRemoved, (components) => {});
events.on(Events.componentStarted, (components) => {});
events.on(Events.componentStopped, (components) => {});
events.on(Events.componentUpdated, (components) => {});

events.on(Events.envUpdate, (envs: {key: string; value: string}[]) => {});
```

## Component

Expand Down
2 changes: 1 addition & 1 deletion developer/pages/blocklet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository:
type: git
url: git+https://github.com/blocklet/blocklet-site.git
specVersion: 1.2.8
version: 0.1.135
version: 0.1.136
logo: logo.png
files: []
interfaces:
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.135
0.1.136
2 changes: 1 addition & 1 deletion website/docs/blocklet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository:
type: git
url: git+https://github.com/blocklet/blocklet-site.git
specVersion: 1.2.8
version: 0.1.135
version: 0.1.136
logo: logo.png
files: []
interfaces:
Expand Down
2 changes: 1 addition & 1 deletion website/pages/blocklet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository:
type: git
url: git+https://github.com/blocklet/blocklet-site.git
specVersion: 1.2.8
version: 0.1.135
version: 0.1.136
logo: logo.png
files: []
interfaces:
Expand Down

0 comments on commit 344d66b

Please sign in to comment.