@pie-players/pie-section-player-tools-event-debugger 0.3.5 → 0.3.7

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/EventPanel.svelte CHANGED
@@ -40,7 +40,12 @@
40
40
  totalItems?: number;
41
41
  } | null;
42
42
  type ToolkitCoordinatorLike = {
43
- subscribeSectionEvents: (args: {
43
+ subscribeItemEvents?: (args: {
44
+ sectionId: string;
45
+ attemptId?: string;
46
+ listener: (event: ControllerEvent) => void;
47
+ }) => () => void;
48
+ subscribeSectionLifecycleEvents?: (args: {
44
49
  sectionId: string;
45
50
  attemptId?: string;
46
51
  listener: (event: ControllerEvent) => void;
@@ -314,12 +319,22 @@
314
319
  }
315
320
 
316
321
  detachControllerSubscription();
317
- subscriptions.controller =
318
- toolkitCoordinator?.subscribeSectionEvents({
322
+ const unsubscribeItem =
323
+ toolkitCoordinator?.subscribeItemEvents?.({
319
324
  sectionId,
320
325
  attemptId,
321
326
  listener: handleControllerEvent,
322
327
  }) || null;
328
+ const unsubscribeSection =
329
+ toolkitCoordinator?.subscribeSectionLifecycleEvents?.({
330
+ sectionId,
331
+ attemptId,
332
+ listener: handleControllerEvent,
333
+ }) || null;
334
+ subscriptions.controller = () => {
335
+ unsubscribeItem?.();
336
+ unsubscribeSection?.();
337
+ };
323
338
  subscriptions.activeSectionId = sectionId;
324
339
  subscriptions.activeAttemptId = nextAttemptId;
325
340
  seedFromRuntimeState(controller);