UNPKG

695 BJavaScriptView Raw
1import { StateNode } from './StateNode.js';
2import { IS_PRODUCTION } from './environment.js';
3
4var warned = false;
5function Machine(config, options, initialContext) {
6 if (initialContext === void 0) {
7 initialContext = config.context;
8 }
9
10 return new StateNode(config, options, initialContext);
11}
12function createMachine(config, options) {
13 if (!IS_PRODUCTION && !('predictableActionArguments' in config) && !warned) {
14 warned = true;
15 console.warn('It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html');
16 }
17
18 return new StateNode(config, options);
19}
20
21export { Machine, createMachine };