xstate 5.16.0 → 5.17.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/actions/dist/xstate-actions.cjs.js +2 -2
- package/actions/dist/xstate-actions.development.cjs.js +2 -2
- package/actions/dist/xstate-actions.development.esm.js +2 -2
- package/actions/dist/xstate-actions.esm.js +2 -2
- package/actions/dist/xstate-actions.umd.min.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js.map +1 -1
- package/actors/dist/xstate-actors.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.esm.js +1 -1
- package/actors/dist/xstate-actors.esm.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/{raise-a6298350.cjs.js → State-30c95050.cjs.js} +199 -191
- package/dist/{raise-7d030497.development.esm.js → State-34039d2a.development.esm.js} +215 -207
- package/dist/{raise-bad6a97b.development.cjs.js → State-a2464a1e.development.cjs.js} +214 -206
- package/dist/{raise-2cfe6b8f.esm.js → State-cdbc7940.esm.js} +200 -192
- package/dist/declarations/src/State.d.ts +12 -11
- package/dist/declarations/src/StateMachine.d.ts +11 -14
- package/dist/declarations/src/StateNode.d.ts +1 -0
- package/dist/declarations/src/actions/stopChild.d.ts +1 -0
- package/dist/declarations/src/actors/callback.d.ts +3 -2
- package/dist/declarations/src/createActor.d.ts +6 -6
- package/dist/declarations/src/createMachine.d.ts +3 -2
- package/dist/declarations/src/index.d.ts +11 -12
- package/dist/declarations/src/inspection.d.ts +3 -2
- package/dist/declarations/src/setup.d.ts +1 -1
- package/dist/declarations/src/stateUtils.d.ts +2 -14
- package/dist/declarations/src/system.d.ts +3 -2
- package/dist/declarations/src/types.d.ts +22 -12
- package/dist/declarations/src/utils.d.ts +1 -5
- package/dist/{log-f9587b82.cjs.js → log-19086852.cjs.js} +1 -1
- package/dist/{log-8320f5e6.esm.js → log-4a38a98a.esm.js} +1 -1
- package/dist/{log-17f4495d.development.esm.js → log-62f17756.development.esm.js} +1 -1
- package/dist/{log-31321d85.development.cjs.js → log-ec36113c.development.cjs.js} +1 -1
- package/dist/xstate.cjs.js +92 -92
- package/dist/xstate.development.cjs.js +95 -95
- package/dist/xstate.development.esm.js +91 -91
- package/dist/xstate.esm.js +88 -88
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.esm.js +1 -1
- package/guards/dist/xstate-guards.esm.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -3
|
@@ -323,7 +323,9 @@ function createSystem(rootActor, options) {
|
|
|
323
323
|
const timeout = timerMap[scheduledEventId];
|
|
324
324
|
delete timerMap[scheduledEventId];
|
|
325
325
|
delete system._snapshot._scheduledEvents[scheduledEventId];
|
|
326
|
-
|
|
326
|
+
if (timeout !== undefined) {
|
|
327
|
+
clock.clearTimeout(timeout);
|
|
328
|
+
}
|
|
327
329
|
},
|
|
328
330
|
cancelAll: actorRef => {
|
|
329
331
|
for (const scheduledEventId in system._snapshot._scheduledEvents) {
|
|
@@ -420,6 +422,7 @@ function createSystem(rootActor, options) {
|
|
|
420
422
|
}
|
|
421
423
|
|
|
422
424
|
const $$ACTOR_TYPE = 1;
|
|
425
|
+
|
|
423
426
|
// those values are currently used by @xstate/react directly so it's important to keep the assigned values in sync
|
|
424
427
|
let ProcessingStatus = /*#__PURE__*/function (ProcessingStatus) {
|
|
425
428
|
ProcessingStatus[ProcessingStatus["NotStarted"] = 0] = "NotStarted";
|
|
@@ -1057,10 +1060,14 @@ function createActor(logic, ...[options]) {
|
|
|
1057
1060
|
* options, if any.
|
|
1058
1061
|
*
|
|
1059
1062
|
* @deprecated Use `createActor` instead
|
|
1063
|
+
* @alias
|
|
1060
1064
|
*/
|
|
1061
1065
|
const interpret = createActor;
|
|
1062
1066
|
|
|
1063
|
-
/**
|
|
1067
|
+
/**
|
|
1068
|
+
* @deprecated Use `Actor` instead.
|
|
1069
|
+
* @alias
|
|
1070
|
+
*/
|
|
1064
1071
|
|
|
1065
1072
|
function resolveCancel(_, snapshot, actionArgs, actionParams, {
|
|
1066
1073
|
sendId
|
|
@@ -1115,135 +1122,6 @@ function cancel(sendId) {
|
|
|
1115
1122
|
return cancel;
|
|
1116
1123
|
}
|
|
1117
1124
|
|
|
1118
|
-
function resolveSpawn(actorScope, snapshot, actionArgs, _actionParams, {
|
|
1119
|
-
id,
|
|
1120
|
-
systemId,
|
|
1121
|
-
src,
|
|
1122
|
-
input,
|
|
1123
|
-
syncSnapshot
|
|
1124
|
-
}) {
|
|
1125
|
-
const logic = typeof src === 'string' ? resolveReferencedActor(snapshot.machine, src) : src;
|
|
1126
|
-
const resolvedId = typeof id === 'function' ? id(actionArgs) : id;
|
|
1127
|
-
let actorRef;
|
|
1128
|
-
if (logic) {
|
|
1129
|
-
actorRef = createActor(logic, {
|
|
1130
|
-
id: resolvedId,
|
|
1131
|
-
src,
|
|
1132
|
-
parent: actorScope.self,
|
|
1133
|
-
syncSnapshot,
|
|
1134
|
-
systemId,
|
|
1135
|
-
input: typeof input === 'function' ? input({
|
|
1136
|
-
context: snapshot.context,
|
|
1137
|
-
event: actionArgs.event,
|
|
1138
|
-
self: actorScope.self
|
|
1139
|
-
}) : input
|
|
1140
|
-
});
|
|
1141
|
-
}
|
|
1142
|
-
return [cloneMachineSnapshot(snapshot, {
|
|
1143
|
-
children: {
|
|
1144
|
-
...snapshot.children,
|
|
1145
|
-
[resolvedId]: actorRef
|
|
1146
|
-
}
|
|
1147
|
-
}), {
|
|
1148
|
-
id,
|
|
1149
|
-
actorRef
|
|
1150
|
-
}];
|
|
1151
|
-
}
|
|
1152
|
-
function executeSpawn(actorScope, {
|
|
1153
|
-
id,
|
|
1154
|
-
actorRef
|
|
1155
|
-
}) {
|
|
1156
|
-
if (!actorRef) {
|
|
1157
|
-
return;
|
|
1158
|
-
}
|
|
1159
|
-
actorScope.defer(() => {
|
|
1160
|
-
if (actorRef._processingStatus === ProcessingStatus.Stopped) {
|
|
1161
|
-
return;
|
|
1162
|
-
}
|
|
1163
|
-
actorRef.start();
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
function spawnChild(...[src, {
|
|
1167
|
-
id,
|
|
1168
|
-
systemId,
|
|
1169
|
-
input,
|
|
1170
|
-
syncSnapshot = false
|
|
1171
|
-
} = {}]) {
|
|
1172
|
-
function spawnChild(args, params) {
|
|
1173
|
-
}
|
|
1174
|
-
spawnChild.type = 'snapshot.spawnChild';
|
|
1175
|
-
spawnChild.id = id;
|
|
1176
|
-
spawnChild.systemId = systemId;
|
|
1177
|
-
spawnChild.src = src;
|
|
1178
|
-
spawnChild.input = input;
|
|
1179
|
-
spawnChild.syncSnapshot = syncSnapshot;
|
|
1180
|
-
spawnChild.resolve = resolveSpawn;
|
|
1181
|
-
spawnChild.execute = executeSpawn;
|
|
1182
|
-
return spawnChild;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
function resolveStop(_, snapshot, args, actionParams, {
|
|
1186
|
-
actorRef
|
|
1187
|
-
}) {
|
|
1188
|
-
const actorRefOrString = typeof actorRef === 'function' ? actorRef(args, actionParams) : actorRef;
|
|
1189
|
-
const resolvedActorRef = typeof actorRefOrString === 'string' ? snapshot.children[actorRefOrString] : actorRefOrString;
|
|
1190
|
-
let children = snapshot.children;
|
|
1191
|
-
if (resolvedActorRef) {
|
|
1192
|
-
children = {
|
|
1193
|
-
...children
|
|
1194
|
-
};
|
|
1195
|
-
delete children[resolvedActorRef.id];
|
|
1196
|
-
}
|
|
1197
|
-
return [cloneMachineSnapshot(snapshot, {
|
|
1198
|
-
children
|
|
1199
|
-
}), resolvedActorRef];
|
|
1200
|
-
}
|
|
1201
|
-
function executeStop(actorScope, actorRef) {
|
|
1202
|
-
if (!actorRef) {
|
|
1203
|
-
return;
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
// we need to eagerly unregister it here so a new actor with the same systemId can be registered immediately
|
|
1207
|
-
// since we defer actual stopping of the actor but we don't defer actor creations (and we can't do that)
|
|
1208
|
-
// this could throw on `systemId` collision, for example, when dealing with reentering transitions
|
|
1209
|
-
actorScope.system._unregister(actorRef);
|
|
1210
|
-
|
|
1211
|
-
// this allows us to prevent an actor from being started if it gets stopped within the same macrostep
|
|
1212
|
-
// this can happen, for example, when the invoking state is being exited immediately by an always transition
|
|
1213
|
-
if (actorRef._processingStatus !== ProcessingStatus.Running) {
|
|
1214
|
-
actorScope.stopChild(actorRef);
|
|
1215
|
-
return;
|
|
1216
|
-
}
|
|
1217
|
-
// stopping a child enqueues a stop event in the child actor's mailbox
|
|
1218
|
-
// we need for all of the already enqueued events to be processed before we stop the child
|
|
1219
|
-
// the parent itself might want to send some events to a child (for example from exit actions on the invoking state)
|
|
1220
|
-
// and we don't want to ignore those events
|
|
1221
|
-
actorScope.defer(() => {
|
|
1222
|
-
actorScope.stopChild(actorRef);
|
|
1223
|
-
});
|
|
1224
|
-
}
|
|
1225
|
-
/**
|
|
1226
|
-
* Stops a child actor.
|
|
1227
|
-
*
|
|
1228
|
-
* @param actorRef The actor to stop.
|
|
1229
|
-
*/
|
|
1230
|
-
function stopChild(actorRef) {
|
|
1231
|
-
function stop(args, params) {
|
|
1232
|
-
}
|
|
1233
|
-
stop.type = 'xstate.stopChild';
|
|
1234
|
-
stop.actorRef = actorRef;
|
|
1235
|
-
stop.resolve = resolveStop;
|
|
1236
|
-
stop.execute = executeStop;
|
|
1237
|
-
return stop;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
/**
|
|
1241
|
-
* Stops a child actor.
|
|
1242
|
-
*
|
|
1243
|
-
* @deprecated Use `stopChild(...)` instead
|
|
1244
|
-
*/
|
|
1245
|
-
const stop = stopChild;
|
|
1246
|
-
|
|
1247
1125
|
function checkStateIn(snapshot, _, {
|
|
1248
1126
|
stateValue
|
|
1249
1127
|
}) {
|
|
@@ -1432,6 +1310,196 @@ function evaluateGuard(guard, context, event, snapshot) {
|
|
|
1432
1310
|
);
|
|
1433
1311
|
}
|
|
1434
1312
|
|
|
1313
|
+
function resolveRaise(_, snapshot, args, actionParams, {
|
|
1314
|
+
event: eventOrExpr,
|
|
1315
|
+
id,
|
|
1316
|
+
delay
|
|
1317
|
+
}, {
|
|
1318
|
+
internalQueue
|
|
1319
|
+
}) {
|
|
1320
|
+
const delaysMap = snapshot.machine.implementations.delays;
|
|
1321
|
+
if (typeof eventOrExpr === 'string') {
|
|
1322
|
+
throw new Error(`Only event objects may be used with raise; use raise({ type: "${eventOrExpr}" }) instead`);
|
|
1323
|
+
}
|
|
1324
|
+
const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args, actionParams) : eventOrExpr;
|
|
1325
|
+
let resolvedDelay;
|
|
1326
|
+
if (typeof delay === 'string') {
|
|
1327
|
+
const configDelay = delaysMap && delaysMap[delay];
|
|
1328
|
+
resolvedDelay = typeof configDelay === 'function' ? configDelay(args, actionParams) : configDelay;
|
|
1329
|
+
} else {
|
|
1330
|
+
resolvedDelay = typeof delay === 'function' ? delay(args, actionParams) : delay;
|
|
1331
|
+
}
|
|
1332
|
+
if (typeof resolvedDelay !== 'number') {
|
|
1333
|
+
internalQueue.push(resolvedEvent);
|
|
1334
|
+
}
|
|
1335
|
+
return [snapshot, {
|
|
1336
|
+
event: resolvedEvent,
|
|
1337
|
+
id,
|
|
1338
|
+
delay: resolvedDelay
|
|
1339
|
+
}];
|
|
1340
|
+
}
|
|
1341
|
+
function executeRaise(actorScope, params) {
|
|
1342
|
+
const {
|
|
1343
|
+
event,
|
|
1344
|
+
delay,
|
|
1345
|
+
id
|
|
1346
|
+
} = params;
|
|
1347
|
+
if (typeof delay === 'number') {
|
|
1348
|
+
actorScope.defer(() => {
|
|
1349
|
+
const self = actorScope.self;
|
|
1350
|
+
actorScope.system.scheduler.schedule(self, self, event, delay, id);
|
|
1351
|
+
});
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Raises an event. This places the event in the internal event queue, so that
|
|
1357
|
+
* the event is immediately consumed by the machine in the current step.
|
|
1358
|
+
*
|
|
1359
|
+
* @param eventType The event to raise.
|
|
1360
|
+
*/
|
|
1361
|
+
function raise(eventOrExpr, options) {
|
|
1362
|
+
function raise(args, params) {
|
|
1363
|
+
}
|
|
1364
|
+
raise.type = 'xstate.raise';
|
|
1365
|
+
raise.event = eventOrExpr;
|
|
1366
|
+
raise.id = options?.id;
|
|
1367
|
+
raise.delay = options?.delay;
|
|
1368
|
+
raise.resolve = resolveRaise;
|
|
1369
|
+
raise.execute = executeRaise;
|
|
1370
|
+
return raise;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
function resolveSpawn(actorScope, snapshot, actionArgs, _actionParams, {
|
|
1374
|
+
id,
|
|
1375
|
+
systemId,
|
|
1376
|
+
src,
|
|
1377
|
+
input,
|
|
1378
|
+
syncSnapshot
|
|
1379
|
+
}) {
|
|
1380
|
+
const logic = typeof src === 'string' ? resolveReferencedActor(snapshot.machine, src) : src;
|
|
1381
|
+
const resolvedId = typeof id === 'function' ? id(actionArgs) : id;
|
|
1382
|
+
let actorRef;
|
|
1383
|
+
if (logic) {
|
|
1384
|
+
actorRef = createActor(logic, {
|
|
1385
|
+
id: resolvedId,
|
|
1386
|
+
src,
|
|
1387
|
+
parent: actorScope.self,
|
|
1388
|
+
syncSnapshot,
|
|
1389
|
+
systemId,
|
|
1390
|
+
input: typeof input === 'function' ? input({
|
|
1391
|
+
context: snapshot.context,
|
|
1392
|
+
event: actionArgs.event,
|
|
1393
|
+
self: actorScope.self
|
|
1394
|
+
}) : input
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
return [cloneMachineSnapshot(snapshot, {
|
|
1398
|
+
children: {
|
|
1399
|
+
...snapshot.children,
|
|
1400
|
+
[resolvedId]: actorRef
|
|
1401
|
+
}
|
|
1402
|
+
}), {
|
|
1403
|
+
id,
|
|
1404
|
+
actorRef
|
|
1405
|
+
}];
|
|
1406
|
+
}
|
|
1407
|
+
function executeSpawn(actorScope, {
|
|
1408
|
+
id,
|
|
1409
|
+
actorRef
|
|
1410
|
+
}) {
|
|
1411
|
+
if (!actorRef) {
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
actorScope.defer(() => {
|
|
1415
|
+
if (actorRef._processingStatus === ProcessingStatus.Stopped) {
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
actorRef.start();
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
function spawnChild(...[src, {
|
|
1422
|
+
id,
|
|
1423
|
+
systemId,
|
|
1424
|
+
input,
|
|
1425
|
+
syncSnapshot = false
|
|
1426
|
+
} = {}]) {
|
|
1427
|
+
function spawnChild(args, params) {
|
|
1428
|
+
}
|
|
1429
|
+
spawnChild.type = 'snapshot.spawnChild';
|
|
1430
|
+
spawnChild.id = id;
|
|
1431
|
+
spawnChild.systemId = systemId;
|
|
1432
|
+
spawnChild.src = src;
|
|
1433
|
+
spawnChild.input = input;
|
|
1434
|
+
spawnChild.syncSnapshot = syncSnapshot;
|
|
1435
|
+
spawnChild.resolve = resolveSpawn;
|
|
1436
|
+
spawnChild.execute = executeSpawn;
|
|
1437
|
+
return spawnChild;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
function resolveStop(_, snapshot, args, actionParams, {
|
|
1441
|
+
actorRef
|
|
1442
|
+
}) {
|
|
1443
|
+
const actorRefOrString = typeof actorRef === 'function' ? actorRef(args, actionParams) : actorRef;
|
|
1444
|
+
const resolvedActorRef = typeof actorRefOrString === 'string' ? snapshot.children[actorRefOrString] : actorRefOrString;
|
|
1445
|
+
let children = snapshot.children;
|
|
1446
|
+
if (resolvedActorRef) {
|
|
1447
|
+
children = {
|
|
1448
|
+
...children
|
|
1449
|
+
};
|
|
1450
|
+
delete children[resolvedActorRef.id];
|
|
1451
|
+
}
|
|
1452
|
+
return [cloneMachineSnapshot(snapshot, {
|
|
1453
|
+
children
|
|
1454
|
+
}), resolvedActorRef];
|
|
1455
|
+
}
|
|
1456
|
+
function executeStop(actorScope, actorRef) {
|
|
1457
|
+
if (!actorRef) {
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
// we need to eagerly unregister it here so a new actor with the same systemId can be registered immediately
|
|
1462
|
+
// since we defer actual stopping of the actor but we don't defer actor creations (and we can't do that)
|
|
1463
|
+
// this could throw on `systemId` collision, for example, when dealing with reentering transitions
|
|
1464
|
+
actorScope.system._unregister(actorRef);
|
|
1465
|
+
|
|
1466
|
+
// this allows us to prevent an actor from being started if it gets stopped within the same macrostep
|
|
1467
|
+
// this can happen, for example, when the invoking state is being exited immediately by an always transition
|
|
1468
|
+
if (actorRef._processingStatus !== ProcessingStatus.Running) {
|
|
1469
|
+
actorScope.stopChild(actorRef);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
// stopping a child enqueues a stop event in the child actor's mailbox
|
|
1473
|
+
// we need for all of the already enqueued events to be processed before we stop the child
|
|
1474
|
+
// the parent itself might want to send some events to a child (for example from exit actions on the invoking state)
|
|
1475
|
+
// and we don't want to ignore those events
|
|
1476
|
+
actorScope.defer(() => {
|
|
1477
|
+
actorScope.stopChild(actorRef);
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Stops a child actor.
|
|
1482
|
+
*
|
|
1483
|
+
* @param actorRef The actor to stop.
|
|
1484
|
+
*/
|
|
1485
|
+
function stopChild(actorRef) {
|
|
1486
|
+
function stop(args, params) {
|
|
1487
|
+
}
|
|
1488
|
+
stop.type = 'xstate.stopChild';
|
|
1489
|
+
stop.actorRef = actorRef;
|
|
1490
|
+
stop.resolve = resolveStop;
|
|
1491
|
+
stop.execute = executeStop;
|
|
1492
|
+
return stop;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Stops a child actor.
|
|
1497
|
+
*
|
|
1498
|
+
* @deprecated Use `stopChild(...)` instead
|
|
1499
|
+
* @alias
|
|
1500
|
+
*/
|
|
1501
|
+
const stop = stopChild;
|
|
1502
|
+
|
|
1435
1503
|
const isAtomicStateNode = stateNode => stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
1436
1504
|
function getChildren(stateNode) {
|
|
1437
1505
|
return Object.values(stateNode.states).filter(sn => sn.type !== 'history');
|
|
@@ -2536,66 +2604,6 @@ function persistContext(contextPart) {
|
|
|
2536
2604
|
return copy ?? contextPart;
|
|
2537
2605
|
}
|
|
2538
2606
|
|
|
2539
|
-
function resolveRaise(_, snapshot, args, actionParams, {
|
|
2540
|
-
event: eventOrExpr,
|
|
2541
|
-
id,
|
|
2542
|
-
delay
|
|
2543
|
-
}, {
|
|
2544
|
-
internalQueue
|
|
2545
|
-
}) {
|
|
2546
|
-
const delaysMap = snapshot.machine.implementations.delays;
|
|
2547
|
-
if (typeof eventOrExpr === 'string') {
|
|
2548
|
-
throw new Error(`Only event objects may be used with raise; use raise({ type: "${eventOrExpr}" }) instead`);
|
|
2549
|
-
}
|
|
2550
|
-
const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args, actionParams) : eventOrExpr;
|
|
2551
|
-
let resolvedDelay;
|
|
2552
|
-
if (typeof delay === 'string') {
|
|
2553
|
-
const configDelay = delaysMap && delaysMap[delay];
|
|
2554
|
-
resolvedDelay = typeof configDelay === 'function' ? configDelay(args, actionParams) : configDelay;
|
|
2555
|
-
} else {
|
|
2556
|
-
resolvedDelay = typeof delay === 'function' ? delay(args, actionParams) : delay;
|
|
2557
|
-
}
|
|
2558
|
-
if (typeof resolvedDelay !== 'number') {
|
|
2559
|
-
internalQueue.push(resolvedEvent);
|
|
2560
|
-
}
|
|
2561
|
-
return [snapshot, {
|
|
2562
|
-
event: resolvedEvent,
|
|
2563
|
-
id,
|
|
2564
|
-
delay: resolvedDelay
|
|
2565
|
-
}];
|
|
2566
|
-
}
|
|
2567
|
-
function executeRaise(actorScope, params) {
|
|
2568
|
-
const {
|
|
2569
|
-
event,
|
|
2570
|
-
delay,
|
|
2571
|
-
id
|
|
2572
|
-
} = params;
|
|
2573
|
-
if (typeof delay === 'number') {
|
|
2574
|
-
actorScope.defer(() => {
|
|
2575
|
-
const self = actorScope.self;
|
|
2576
|
-
actorScope.system.scheduler.schedule(self, self, event, delay, id);
|
|
2577
|
-
});
|
|
2578
|
-
return;
|
|
2579
|
-
}
|
|
2580
|
-
}
|
|
2581
|
-
/**
|
|
2582
|
-
* Raises an event. This places the event in the internal event queue, so that
|
|
2583
|
-
* the event is immediately consumed by the machine in the current step.
|
|
2584
|
-
*
|
|
2585
|
-
* @param eventType The event to raise.
|
|
2586
|
-
*/
|
|
2587
|
-
function raise(eventOrExpr, options) {
|
|
2588
|
-
function raise(args, params) {
|
|
2589
|
-
}
|
|
2590
|
-
raise.type = 'xstate.raise';
|
|
2591
|
-
raise.event = eventOrExpr;
|
|
2592
|
-
raise.id = options?.id;
|
|
2593
|
-
raise.delay = options?.delay;
|
|
2594
|
-
raise.resolve = resolveRaise;
|
|
2595
|
-
raise.execute = executeRaise;
|
|
2596
|
-
return raise;
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
2607
|
exports.$$ACTOR_TYPE = $$ACTOR_TYPE;
|
|
2600
2608
|
exports.Actor = Actor;
|
|
2601
2609
|
exports.NULL_EVENT = NULL_EVENT;
|