@forcecalendar/interface 1.0.43 → 1.0.44

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.
@@ -179,39 +179,35 @@ class T {
179
179
  t.handler === e && this.wildcardHandlers.delete(t);
180
180
  }
181
181
  /**
182
- * Emit an event
182
+ * Emit an event synchronously
183
183
  * @param {string} eventName - Event name
184
184
  * @param {*} data - Event data
185
- * @returns {Promise} Resolves when all handlers complete
186
185
  */
187
- async emit(e, t) {
188
- const r = [];
186
+ emit(e, t) {
189
187
  if (this.events.has(e)) {
190
- const i = [...this.events.get(e)];
191
- for (const n of i) {
192
- const { handler: o, once: a } = n;
193
- a && this.off(e, o);
188
+ const s = [...this.events.get(e)];
189
+ for (const i of s) {
190
+ const { handler: n, once: o } = i;
191
+ o && this.off(e, n);
194
192
  try {
195
- const c = o(t, e);
196
- c instanceof Promise && r.push(c);
197
- } catch (c) {
198
- console.error(`Error in event handler for ${e}:`, c);
193
+ n(t, e);
194
+ } catch (a) {
195
+ console.error(`Error in event handler for ${e}:`, a);
199
196
  }
200
197
  }
201
198
  }
202
- const s = [];
203
- for (const i of [...this.wildcardHandlers])
204
- if (this.matchesPattern(e, i.pattern)) {
205
- const { handler: n, once: o } = i;
206
- o && s.push(i);
199
+ const r = [];
200
+ for (const s of [...this.wildcardHandlers])
201
+ if (this.matchesPattern(e, s.pattern)) {
202
+ const { handler: i, once: n } = s;
203
+ n && r.push(s);
207
204
  try {
208
- const a = n(t, e);
209
- a instanceof Promise && r.push(a);
210
- } catch (a) {
211
- console.error(`Error in wildcard handler for ${e}:`, a);
205
+ i(t, e);
206
+ } catch (o) {
207
+ console.error(`Error in wildcard handler for ${e}:`, o);
212
208
  }
213
209
  }
214
- return s.forEach((i) => this.wildcardHandlers.delete(i)), Promise.all(r);
210
+ r.forEach((s) => this.wildcardHandlers.delete(s));
215
211
  }
216
212
  /**
217
213
  * Check if event name matches a pattern