floating-live 0.15.6 → 0.15.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,9 @@ class ModValue {
5
5
  constructor(main) {
6
6
  this.list = new Map();
7
7
  this.main = main;
8
+ const { command } = main;
9
+ command.register("get", this.get.bind(this));
10
+ command.register("set", this.set.bind(this));
8
11
  }
9
12
  /** 注册值 */
10
13
  register(name, config) {
@@ -1,11 +1,23 @@
1
1
  import { LiveRoom } from "../core";
2
2
  import { RoomInfo } from "./room";
3
+ import { FloatingValueMap } from "./value";
3
4
  export interface FloatingCommandMap {
5
+ /** 添加房间 */
4
6
  add: (platform: string, id: number, options?: boolean | Record<string, any>) => void;
7
+ /** 移除房间 */
5
8
  remove: (key: string) => void;
9
+ /** 打开房间 */
6
10
  open: (key: string) => void;
11
+ /** 关闭房间 */
7
12
  close: (key: string) => void;
13
+ /** 更新房间信息 */
8
14
  update: (key: string) => void;
15
+ /** 创建房间 */
9
16
  [name: `${string}.room.create`]: (id: string | number, options?: Record<string, any>) => Promise<LiveRoom> | LiveRoom;
17
+ /** 获取房间信息 */
10
18
  [name: `${string}.room.info`]: (id: string | number) => Promise<RoomInfo>;
19
+ /** 获取值 */
20
+ get: <N extends keyof FloatingValueMap>(name: N) => FloatingValueMap[N];
21
+ /** 设置值 */
22
+ set: <N extends keyof FloatingValueMap>(name: N, value: FloatingValueMap[N]) => boolean;
11
23
  }
@@ -2,6 +2,9 @@ export class ModValue {
2
2
  constructor(main) {
3
3
  this.list = new Map();
4
4
  this.main = main;
5
+ const { command } = main;
6
+ command.register("get", this.get.bind(this));
7
+ command.register("set", this.set.bind(this));
5
8
  }
6
9
  /** 注册值 */
7
10
  register(name, config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.15.6",
3
+ "version": "0.15.7",
4
4
  "type": "commonjs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",