floating-live 0.14.0 → 0.14.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "type": "commonjs",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -6,7 +6,7 @@ export declare class Reglist<T> {
6
6
  /** 插件与功能名称绑定表 */
7
7
  private readonly pluginIdMap;
8
8
  private readonly name;
9
- private readonly main;
9
+ protected readonly main: FloatingLive;
10
10
  constructor(main: FloatingLive, name: string);
11
11
  /** 注册一个对象 */
12
12
  register(id: string, item: T): void;
@@ -15,7 +15,7 @@ class ModRooms {
15
15
  this.roomMap.forEach((room) => {
16
16
  list.push(room.info);
17
17
  });
18
- return list;
18
+ return { list };
19
19
  });
20
20
  this.main.command.batchRegister({
21
21
  add: (platform, id, open) => {
@@ -3,4 +3,10 @@ import { Reglist } from "../abstract/Reglist";
3
3
  export declare class ModState extends Reglist<() => object> {
4
4
  constructor(main: FloatingLive);
5
5
  generate(): Record<string, any>;
6
+ /** 设置一个值 */
7
+ set(name: string, value: any): void;
8
+ /** 在数组中添加一个值 */
9
+ arrayPush(name: string, value: any): void;
10
+ /** 在数组中移除一个值 */
11
+ arrayRemove(name: string, key: string, val: string): void;
6
12
  }
@@ -13,5 +13,17 @@ class ModState extends Reglist_1.Reglist {
13
13
  });
14
14
  return state;
15
15
  }
16
+ /** 设置一个值 */
17
+ set(name, value) {
18
+ this.main.emit("state:set", name, value);
19
+ }
20
+ /** 在数组中添加一个值 */
21
+ arrayPush(name, value) {
22
+ this.main.emit("state:array_push", name, value);
23
+ }
24
+ /** 在数组中移除一个值 */
25
+ arrayRemove(name, key, val) {
26
+ this.main.emit("state:array_remove", name, key, val);
27
+ }
16
28
  }
17
29
  exports.ModState = ModState;