Machine.js 833 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var StateNode = require('./StateNode.js');
  4. var environment = require('./environment.js');
  5. var warned = false;
  6. function Machine(config, options, initialContext) {
  7. if (initialContext === void 0) {
  8. initialContext = config.context;
  9. }
  10. return new StateNode.StateNode(config, options, initialContext);
  11. }
  12. function createMachine(config, options) {
  13. if (!environment.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. return new StateNode.StateNode(config, options);
  18. }
  19. exports.Machine = Machine;
  20. exports.createMachine = createMachine;