@pie-element/shared-player-events 0.1.1-next.0 → 0.1.1-next.1

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.
Files changed (2) hide show
  1. package/README.md +11 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -61,31 +61,29 @@ response.
61
61
  `delayMs` accepts a function, for an element whose delay depends on its model.
62
62
  `maxWaitMs` bounds how long repeated calls may postpone a dispatch. `flush()` is
63
63
  a no-op when nothing is pending, so a teardown adds no event in the normal path.
64
- `onDispatchError` receives a dispatch that throws during a flush; the throw is
65
- contained either way, since a commit runs mid-unmount, and the default reports it
66
- through `console.warn` so a lost response is not silent.
64
+ A dispatch that throws during a flush is contained, since a commit runs
65
+ mid-unmount, and reported through `console.warn` so a lost response is not
66
+ silent.
67
67
 
68
68
  The helper also installs `commitPendingSession()` on the host. A player calls it
69
69
  on each mounted element before discarding it, so the element dispatches its own
70
70
  event — with its own `complete` semantics — while still attached and therefore
71
71
  still able to reach a `document`-level listener. An element's own
72
72
  `disconnectedCallback` runs after removal, where the event never gets that far.
73
+ When the call dispatches nothing, the player synthesizes the event from
74
+ `element.session`.
73
75
 
74
- The install is an own-property check: an element class that declares its own
75
- `commitPendingSession` keeps it, and the installed method calls it before
76
- flushing the notifiers. Yielding to it instead would let a player count the
77
- element as committed while the pending dispatch was dropped. `dispose()` on the
78
- last notifier removes the method again, because an element that still advertises
79
- it but flushes nothing suppresses the player's synthesized fallback for good.
76
+ The installed method is an own property of the host. A `commitPendingSession`
77
+ the element class declares still runs: the installed method calls it, then
78
+ flushes the notifiers, so a player's call never skips a pending dispatch.
80
79
 
81
80
  ### Elements that do not defer
82
81
 
83
82
  The `elements-svelte` packages (`mc-populated-blank`, `simple-cloze`,
84
83
  `venn-classification`) dispatch `session-changed` synchronously on every change,
85
- so nothing is ever pending and a commit seam has nothing to flush. They must
86
- also not install `commitPendingSession()`: a player that finds the method counts
87
- the element as having committed itself and never synthesizes an event from
88
- `element.session`, which is the path that does cover them.
84
+ so nothing is ever pending and they install no `commitPendingSession()`. A
85
+ player's commit sweep synthesizes their event from `element.session` whenever
86
+ the host has not heard the response it holds.
89
87
 
90
88
  What those elements owe a player instead is that `element.session` carries the
91
89
  response by the time the event is dispatched, written into the object the player
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/shared-player-events",
3
- "version": "0.1.1-next.0",
3
+ "version": "0.1.1-next.1",
4
4
  "description": "PIE Player Events (ESM) - internalized from @pie-framework/pie-player-events",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",