Machine.js 695 B

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