floating-live 0.14.4 → 0.14.5

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.4",
3
+ "version": "0.14.5",
4
4
  "type": "commonjs",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -14,7 +14,7 @@ export declare class ModPlugin<T extends FloatingLive> {
14
14
  /** 访问插件操作对象 */
15
15
  access(name: string): object | undefined;
16
16
  /** 注册插件 */
17
- register(pluginFunc: FloatingLivePlugin<T>): object | undefined;
17
+ register(pluginFunc: FloatingLivePlugin<T>, pluginConfig?: object): object | undefined;
18
18
  /** 移除插件 */
19
19
  unregister(name: string): void;
20
20
  }
@@ -27,7 +27,7 @@ class ModPlugin {
27
27
  return this.exports.get(name);
28
28
  }
29
29
  /** 注册插件 */
30
- register(pluginFunc) {
30
+ register(pluginFunc, pluginConfig) {
31
31
  // 执行插件函数
32
32
  const plugin = pluginFunc();
33
33
  const name = plugin.name;
@@ -38,7 +38,7 @@ class ModPlugin {
38
38
  this.list.set(name, plugin);
39
39
  this.current = name;
40
40
  // 调用register函数,并保存获取值
41
- let pluginExpose = plugin.register?.(this.main) || {};
41
+ let pluginExpose = plugin.register?.(this.main, pluginConfig) || {};
42
42
  this.exports.set(name, pluginExpose);
43
43
  this.main.emit("plugin:add", name);
44
44
  this.current = null;
@@ -3,6 +3,6 @@ import { FloatingLive } from "..";
3
3
  export declare type FloatingLivePlugin<T extends FloatingLive> = () => {
4
4
  /** 插件名称 */
5
5
  name: string;
6
- register: (ctx: T) => object | void;
6
+ register: (ctx: T, config?: object) => object | void;
7
7
  destroy?: (ctx: T) => void;
8
8
  };