@pie-element/shared-player-events 0.1.1-next.0 → 0.1.1-next.2
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/README.md +11 -16
- 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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
|
75
|
-
|
|
76
|
-
|
|
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
|
|
86
|
-
|
|
87
|
-
the
|
|
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
|
|
@@ -95,6 +93,3 @@ handed the element rather than a replacement reference — `writeSessionInPlace`
|
|
|
95
93
|
## Notes
|
|
96
94
|
|
|
97
95
|
- Events bubble and are composed by default.
|
|
98
|
-
- The legacy `pie.*` events (`pie.model_set`, `pie.session_changed`,
|
|
99
|
-
`pie.model_updated`, declared in `@pie-element/shared-types`) are
|
|
100
|
-
compatibility-only and not the primary runtime interop contract.
|
package/package.json
CHANGED