@forcecalendar/interface 1.0.43 → 1.0.45
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/dist/force-calendar-interface.esm.js +567 -568
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +12 -12
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +17 -2
- package/src/core/EventBus.js +4 -15
- package/src/core/StateManager.js +4 -0
package/package.json
CHANGED
|
@@ -50,8 +50,8 @@ export class ForceCalendar extends BaseComponent {
|
|
|
50
50
|
|
|
51
51
|
this.stateManager = new StateManager(config);
|
|
52
52
|
|
|
53
|
-
// Subscribe to state changes
|
|
54
|
-
this.stateManager.subscribe(this.handleStateChange.bind(this));
|
|
53
|
+
// Subscribe to state changes (store unsubscribe for cleanup)
|
|
54
|
+
this._stateUnsubscribe = this.stateManager.subscribe(this.handleStateChange.bind(this));
|
|
55
55
|
|
|
56
56
|
// Listen for events
|
|
57
57
|
this.setupEventListeners();
|
|
@@ -903,10 +903,25 @@ export class ForceCalendar extends BaseComponent {
|
|
|
903
903
|
this.stateManager.today();
|
|
904
904
|
}
|
|
905
905
|
|
|
906
|
+
unmount() {
|
|
907
|
+
// Called by disconnectedCallback — clean up all subscriptions
|
|
908
|
+
this.destroy();
|
|
909
|
+
}
|
|
910
|
+
|
|
906
911
|
destroy() {
|
|
907
912
|
this._busUnsubscribers.forEach(unsub => unsub());
|
|
908
913
|
this._busUnsubscribers = [];
|
|
909
914
|
|
|
915
|
+
if (this._stateUnsubscribe) {
|
|
916
|
+
this._stateUnsubscribe();
|
|
917
|
+
this._stateUnsubscribe = null;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (this._currentViewInstance && this._currentViewInstance.cleanup) {
|
|
921
|
+
this._currentViewInstance.cleanup();
|
|
922
|
+
this._currentViewInstance = null;
|
|
923
|
+
}
|
|
924
|
+
|
|
910
925
|
if (this.stateManager) {
|
|
911
926
|
this.stateManager.destroy();
|
|
912
927
|
}
|
package/src/core/EventBus.js
CHANGED
|
@@ -120,14 +120,11 @@ class EventBus {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
* Emit an event
|
|
123
|
+
* Emit an event synchronously
|
|
124
124
|
* @param {string} eventName - Event name
|
|
125
125
|
* @param {*} data - Event data
|
|
126
|
-
* @returns {Promise} Resolves when all handlers complete
|
|
127
126
|
*/
|
|
128
|
-
|
|
129
|
-
const promises = [];
|
|
130
|
-
|
|
127
|
+
emit(eventName, data) {
|
|
131
128
|
// Handle direct subscriptions
|
|
132
129
|
if (this.events.has(eventName)) {
|
|
133
130
|
const handlers = [...this.events.get(eventName)];
|
|
@@ -140,10 +137,7 @@ class EventBus {
|
|
|
140
137
|
}
|
|
141
138
|
|
|
142
139
|
try {
|
|
143
|
-
|
|
144
|
-
if (result instanceof Promise) {
|
|
145
|
-
promises.push(result);
|
|
146
|
-
}
|
|
140
|
+
handler(data, eventName);
|
|
147
141
|
} catch (error) {
|
|
148
142
|
console.error(`Error in event handler for ${eventName}:`, error);
|
|
149
143
|
}
|
|
@@ -161,10 +155,7 @@ class EventBus {
|
|
|
161
155
|
}
|
|
162
156
|
|
|
163
157
|
try {
|
|
164
|
-
|
|
165
|
-
if (result instanceof Promise) {
|
|
166
|
-
promises.push(result);
|
|
167
|
-
}
|
|
158
|
+
handler(data, eventName);
|
|
168
159
|
} catch (error) {
|
|
169
160
|
console.error(`Error in wildcard handler for ${eventName}:`, error);
|
|
170
161
|
}
|
|
@@ -172,8 +163,6 @@ class EventBus {
|
|
|
172
163
|
}
|
|
173
164
|
// Remove one-time handlers after iteration
|
|
174
165
|
toRemove.forEach(sub => this.wildcardHandlers.delete(sub));
|
|
175
|
-
|
|
176
|
-
return Promise.all(promises);
|
|
177
166
|
}
|
|
178
167
|
|
|
179
168
|
/**
|
package/src/core/StateManager.js
CHANGED