request-iframe 0.2.0 → 0.2.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.
- package/cdn/request-iframe.umd.js +26 -0
- package/cdn/request-iframe.umd.js.map +1 -1
- package/cdn/request-iframe.umd.min.js +1 -1
- package/cdn/request-iframe.umd.min.js.map +1 -1
- package/esm/message/dispatcher.js +27 -0
- package/library/message/dispatcher.d.ts.map +1 -1
- package/library/message/dispatcher.js +27 -0
- package/package.json +1 -1
|
@@ -10249,6 +10249,7 @@
|
|
|
10249
10249
|
return;
|
|
10250
10250
|
}
|
|
10251
10251
|
}
|
|
10252
|
+
var offEarlyAutoAck;
|
|
10252
10253
|
try {
|
|
10253
10254
|
this.hooks.inbound.call(data, context);
|
|
10254
10255
|
var _type = data.type;
|
|
@@ -10272,6 +10273,25 @@
|
|
|
10272
10273
|
autoAckState.sent = true;
|
|
10273
10274
|
this.tryAutoAck(data, context);
|
|
10274
10275
|
};
|
|
10276
|
+
|
|
10277
|
+
/**
|
|
10278
|
+
* Early auto-ack: send ACK as soon as the handler "accepts" the message.
|
|
10279
|
+
*
|
|
10280
|
+
* Why:
|
|
10281
|
+
* - For request delivery confirmation, ACK should represent "accepted/claimed by server"
|
|
10282
|
+
* instead of "handler finished".
|
|
10283
|
+
* - This keeps client-side ackTimeout meaningful and avoids being delayed by business logic.
|
|
10284
|
+
*
|
|
10285
|
+
* Notes:
|
|
10286
|
+
* - Only contexts created by MessageChannel have onStateChange; tests may provide mocks.
|
|
10287
|
+
* - We keep the original end-of-dispatch maybeAutoAck() as a fallback for older/edge contexts.
|
|
10288
|
+
*/
|
|
10289
|
+
var onStateChangeMaybe = context.onStateChange;
|
|
10290
|
+
offEarlyAutoAck = typeof onStateChangeMaybe === 'function' ? onStateChangeMaybe('autoAck:early', (_prev, next) => {
|
|
10291
|
+
if (next === MessageContextStage.ACCEPTED) {
|
|
10292
|
+
maybeAutoAck();
|
|
10293
|
+
}
|
|
10294
|
+
}) : undefined;
|
|
10275
10295
|
var _iterator = _createForOfIteratorHelper$4(this.handlers),
|
|
10276
10296
|
_step;
|
|
10277
10297
|
try {
|
|
@@ -10315,6 +10335,12 @@
|
|
|
10315
10335
|
}
|
|
10316
10336
|
maybeAutoAck();
|
|
10317
10337
|
} finally {
|
|
10338
|
+
try {
|
|
10339
|
+
var _offEarlyAutoAck;
|
|
10340
|
+
(_offEarlyAutoAck = offEarlyAutoAck) === null || _offEarlyAutoAck === void 0 || _offEarlyAutoAck();
|
|
10341
|
+
} catch (_unused) {
|
|
10342
|
+
// ignore
|
|
10343
|
+
}
|
|
10318
10344
|
/**
|
|
10319
10345
|
* Mark as "done" only when this dispatcher actually claimed/handled this message.
|
|
10320
10346
|
* - If the message was never claimed (handledBy not set), we keep `doneBy` empty so another
|