Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
imtaotao committed Sep 18, 2024
1 parent 1e029b8 commit bf439c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/en/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,18 @@ We also provide a `CDN` for development and debugging purposes. **Do not use thi

The `danmu` core package exposes only a `create` method, which is used to create a `manager` instance. Yes, all our implementations are multi-instance. For the configuration options that can be passed during creation, please refer to the [**Configuration**](../reference/manager-configuration) section.

```ts
```ts {9}
import { create } from 'danmu';

// Create a manager instance here. If no configuration is passed,
// the default configuration will be used.
const manager = create({
trackHeight: '20%',
plugin: {
$createNode(danmaku) {
danmaku.node.textContent = danmaku.data;
},

willRender(ref) {
// Types of Danmaku to be Rendered
console.log(ref.type);
Expand Down
6 changes: 5 additions & 1 deletion docs/zh/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ $ yarn add danmu

`danmu` 核心包只暴露了一个 `create` 方法,用来创建一个 `manager` 实例,是的,我们所有的实现都是多实例的方式实现的,创建的时候传入的配置可以看[**配置**](../reference/manager-configuration)这一章节的介绍。

```ts
```ts {8}
import { create } from 'danmu';

// 在此处创建一个 manager 实例,如果不传递则会使用默认的配置
const manager = create({
trackHeight: '20%',
plugin: {
$createNode(danmaku) {
danmaku.node.textContent = danmaku.data;
},

willRender(ref) {
console.log(ref.type); // 即将要渲染的弹幕类型
console.log(ref.danmaku); // 即将要渲染的弹幕实例
Expand Down

0 comments on commit bf439c0

Please sign in to comment.