@mmstack/primitives 22.10.1 → 22.10.3
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.
|
@@ -6917,14 +6917,27 @@ function storeTabSync(sig, opt, bus, injector) {
|
|
|
6917
6917
|
case 'hello': {
|
|
6918
6918
|
if (phase !== 'live' || msg.from === sync.origin)
|
|
6919
6919
|
return;
|
|
6920
|
-
|
|
6921
|
-
const timer = setTimeout(() => {
|
|
6922
|
-
responseTimers.delete(msg.from);
|
|
6920
|
+
const respond = () => {
|
|
6923
6921
|
const snap = sync.snapshot();
|
|
6924
6922
|
const covered = Object.entries(snap.wm).every(([origin, v]) => (msg.wm[origin] ?? 0) >= v);
|
|
6925
6923
|
post(covered
|
|
6926
6924
|
? { t: 'uptodate', proto: OP_PROTO_VERSION, to: msg.from }
|
|
6927
6925
|
: { t: 'state', proto: OP_PROTO_VERSION, to: msg.from, state: snap });
|
|
6926
|
+
};
|
|
6927
|
+
// `jitterMs: 0` answers HERE, in the message handler, with no timer at all. This is the
|
|
6928
|
+
// difference between "as fast as possible" and "possible": a hidden tab's timers are
|
|
6929
|
+
// aligned to ≥1s, so even setTimeout(0) from a backgrounded responder routinely outlives
|
|
6930
|
+
// the joiner's hello window — while message events are not throttled. A channel whose
|
|
6931
|
+
// typical population is one hidden responder (a builder answering its preview tab) opts
|
|
6932
|
+
// in; the jittered path stays the default for many-peer channels.
|
|
6933
|
+
if (jitterMs === 0) {
|
|
6934
|
+
respond();
|
|
6935
|
+
return;
|
|
6936
|
+
}
|
|
6937
|
+
// first responder wins: jittered answer, cancelled when someone else answers first
|
|
6938
|
+
const timer = setTimeout(() => {
|
|
6939
|
+
responseTimers.delete(msg.from);
|
|
6940
|
+
respond();
|
|
6928
6941
|
}, Math.random() * jitterMs);
|
|
6929
6942
|
responseTimers.set(msg.from, timer);
|
|
6930
6943
|
return;
|
|
@@ -7435,5 +7448,5 @@ function withHistory(sourceOrValue, opt) {
|
|
|
7435
7448
|
* Generated bundle index. Do not edit.
|
|
7436
7449
|
*/
|
|
7437
7450
|
|
|
7438
|
-
export { CONCURRENCY_INSTRUMENTATION, MmActivity, MmTransition, MmViewTransitionName, OP_PROTO_VERSION, PAUSABLE_OPTIONS, PERSISTED_STORE_OPTIONS, POS_SEGMENT, SuspenseBoundary, SuspenseBoundaryBase, UnscopedSuspenseBoundary, activeTransaction, applyOps, batteryStatus, bridgeScopeToPendingTasks, chunked, clipboard, combineWith, compareHlc, compareSiblings, compareTotal, createAttributedPending, createConvergingApply, createForwardingScope, createHlcClock, createStoreContext, createTransaction, createTransitionScope, debounce, debounced, defaultFold, deferredValue, derived, diffOps, distinct, elementSize, elementVisibility, extendStore, filter, filterWith, focusWithin, forkStore, geolocation, getTransitionScope, holdUntilReady, idle, indexArray, injectPaused, injectRegisterResource, injectStartTransaction, injectStartTransition, injectTransitionScope, insertElement, invertBatch, isConflicted, isDerivation, isLeaf, isMutable, isOpaque, isStore, isStored, keepPrevious, keyArray, keyedArray, latest, lww, map, mapArray, mapObject, mediaQuery, merge3, mergeThree, mousePosition, moveElement, mutable, mutableStore, nestedEffect, networkStatus, opLog, opSync, opaque, orderedEntries, orientation, pageVisibility, pairwise, pausableComputed, pausableEffect, pausableSignal, perfCustomTracks, persist, persistedStore, pipeable, piped, pointerDrag, policyStrategy, pooled, pooledArray, pooledMap, pooledSet, posBetween, prefersDarkMode, prefersReducedMotion, preserve, projection, provideConcurrencyInstrumentation, provideForwardingTransitionScope, providePausableOptions, providePaused, providePersistedStoreOptions, provideTransitionScope, rebalanceContainer, rebaseOps, reconcile, registerResource, removeElement, resolvePause, scan, scrollPosition, select, sensor, sensors, signalFromEvent, startWith, store, storeHistory, stored, syncedFork, tabSync, tap, throttle, throttled, toFakeDerivation, toFakeSignalDerivation, toStore, toWritable, traced, until, use, validateEnvelope, windowSize, withHistory };
|
|
7451
|
+
export { CONCURRENCY_INSTRUMENTATION, MmActivity, MmTransition, MmViewTransitionName, OP_PROTO_VERSION, PAUSABLE_OPTIONS, PERSISTED_STORE_OPTIONS, POS_SEGMENT, SuspenseBoundary, SuspenseBoundaryBase, UnscopedSuspenseBoundary, activeTransaction, applyOps, batteryStatus, bridgeScopeToPendingTasks, chunked, clipboard, combineWith, compareHlc, compareSiblings, compareTotal, createAttributedPending, createConvergingApply, createForwardingScope, createHlcClock, createStoreContext, createTransaction, createTransitionScope, debounce, debounced, defaultFold, deferredValue, derived, diffOps, distinct, elementSize, elementVisibility, extendStore, filter, filterWith, focusWithin, forkStore, geolocation, getTransitionScope, holdUntilReady, idle, indexArray, injectPaused, injectRegisterResource, injectStartTransaction, injectStartTransition, injectTransitionScope, insertElement, invertBatch, isConflicted, isDerivation, isLeaf, isMutable, isOpaque, isStore, isStored, keepPrevious, keyArray, keyedArray, latest, lww, map, mapArray, mapObject, mediaQuery, merge3, mergeThree, mousePosition, moveElement, mutable, mutableStore, nestedEffect, networkStatus, opLog, opSync, opaque, orderedEntries, orientation, pageVisibility, pairwise, pausableComputed, pausableEffect, pausableSignal, perfCustomTracks, persist, persistedStore, pipeable, piped, pointerDrag, policyStrategy, pooled, pooledArray, pooledKeys, pooledMap, pooledSet, posBetween, prefersDarkMode, prefersReducedMotion, preserve, projection, provideConcurrencyInstrumentation, provideForwardingTransitionScope, providePausableOptions, providePaused, providePersistedStoreOptions, provideTransitionScope, rebalanceContainer, rebaseOps, reconcile, registerResource, removeElement, resolvePause, scan, scrollPosition, select, sensor, sensors, signalFromEvent, startWith, store, storeHistory, stored, syncedFork, tabSync, tap, throttle, throttled, toFakeDerivation, toFakeSignalDerivation, toStore, toWritable, traced, until, use, validateEnvelope, windowSize, withHistory };
|
|
7439
7452
|
//# sourceMappingURL=mmstack-primitives.mjs.map
|