floating-live 0.17.0-alpha.8 → 0.17.0-alpha.9

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.
@@ -23,6 +23,7 @@ export interface AppEventDetailMap {
23
23
  "plugin:register": PluginInfo;
24
24
  "plugin:unregister": {
25
25
  pluginName: string;
26
+ role: string;
26
27
  };
27
28
  "value:register": {
28
29
  name: string;
@@ -46,6 +46,7 @@ export class PluginManager {
46
46
  // 将插件数据注册到列表中
47
47
  this.list.set(pluginName, {
48
48
  plugin,
49
+ role,
49
50
  context: pluginCtx,
50
51
  exposes,
51
52
  unremovable: unremovable || false,
@@ -114,6 +115,7 @@ export class PluginManager {
114
115
  const exposes = await plugin.expose?.(pluginCtx);
115
116
  this.list.set(pluginName, {
116
117
  plugin,
118
+ role,
117
119
  context: pluginCtx,
118
120
  exposes,
119
121
  unremovable: unremovable,
@@ -171,7 +173,7 @@ export class PluginManager {
171
173
  // 从列表中移除插件
172
174
  this.list.delete(pluginName);
173
175
  // 移除插件注册事件
174
- this.app.emit("plugin:unregister", { pluginName });
176
+ this.app.emit("plugin:unregister", { pluginName, role: pluginData.role });
175
177
  // 如果有whenRegister的回调,调用whenUnregistered函数并将回调函数从列表中移除
176
178
  const callbackMap = this.whenRegisterMap.get(pluginName);
177
179
  if (callbackMap) {
@@ -43,6 +43,7 @@ export interface PluginRegisterOptions {
43
43
  }
44
44
  export interface PluginData<T> {
45
45
  plugin: PluginItem;
46
+ role: string;
46
47
  context: PluginContext;
47
48
  exposes?: T;
48
49
  unremovable: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.17.0-alpha.8",
3
+ "version": "0.17.0-alpha.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",