From bf439c0b26dc9f4c265a7b940697f4e2100d0dc5 Mon Sep 17 00:00:00 2001 From: imtaotao Date: Wed, 18 Sep 2024 17:29:49 +0800 Subject: [PATCH] docs: update docs --- docs/en/guide/getting-started.md | 6 +++++- docs/zh/guide/getting-started.md | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/en/guide/getting-started.md b/docs/en/guide/getting-started.md index 508ce105..f9771251 100644 --- a/docs/en/guide/getting-started.md +++ b/docs/en/guide/getting-started.md @@ -45,7 +45,7 @@ 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, @@ -53,6 +53,10 @@ import { create } from 'danmu'; 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); diff --git a/docs/zh/guide/getting-started.md b/docs/zh/guide/getting-started.md index 512daaa7..32d34a52 100644 --- a/docs/zh/guide/getting-started.md +++ b/docs/zh/guide/getting-started.md @@ -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); // 即将要渲染的弹幕实例