floating-live 0.17.0-alpha.10 → 0.17.0-alpha.12

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.
@@ -159,7 +159,7 @@ export class PluginManager {
159
159
  });
160
160
  }
161
161
  else {
162
- const { plugin, context, unremovable } = pluginData;
162
+ const { plugin, context, unremovable, role } = pluginData;
163
163
  if (unremovable) {
164
164
  throw appError("plugin:unregister_unremovable", {
165
165
  message: `插件移除失败: ${pluginName}`,
@@ -173,7 +173,7 @@ export class PluginManager {
173
173
  // 从列表中移除插件
174
174
  this.list.delete(pluginName);
175
175
  // 移除插件注册事件
176
- this.app.emit("plugin:unregister", { pluginName, role: pluginData.role });
176
+ this.app.emit("plugin:unregister", { pluginName, role });
177
177
  // 如果有whenRegister的回调,调用whenUnregistered函数并将回调函数从列表中移除
178
178
  const callbackMap = this.whenRegisterMap.get(pluginName);
179
179
  if (callbackMap) {
@@ -204,7 +204,7 @@ export class Room extends BasePlugin {
204
204
  }
205
205
  if (invalidRoom.valid == true) {
206
206
  throw appError("room:validate_valid", {
207
- message: `无法将已经有效的房间再次设为有效[${key}]`,
207
+ message: `无法使已经有效的房间生效[${key}]`,
208
208
  target: `room/${key}`,
209
209
  });
210
210
  }
@@ -213,6 +213,10 @@ export class Room extends BasePlugin {
213
213
  ...options,
214
214
  allowInvalidRoom: false,
215
215
  });
216
+ // 如果房间有效,则绑定事件
217
+ if (room.valid) {
218
+ this.bindEvent(room);
219
+ }
216
220
  this.map.set(key, room);
217
221
  this.ctx.emit("room:validate", { key, room: room.toData() });
218
222
  }
@@ -225,9 +229,9 @@ export class Room extends BasePlugin {
225
229
  target: `room/${key}`,
226
230
  });
227
231
  }
228
- if (room.valid == true) {
232
+ if (!room.valid) {
229
233
  throw appError("room:invalidate_invalid", {
230
- message: `无法将已经无效的房间再次设为无效[${key}]`,
234
+ message: `无法使已经无效的房间失效[${key}]`,
231
235
  target: `room/${key}`,
232
236
  });
233
237
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.17.0-alpha.10",
3
+ "version": "0.17.0-alpha.12",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",