kitchen-simulator
Version:
It is a kitchen simulator (self-contained micro-frontend).
34 lines • 1.96 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import actions from "../actions/export";
export default function consoleDebugger() {
return function (store, stateExtractor) {
window.KitchenConfigurator = _objectSpread(_objectSpread({}, actions), {}, {
getStore: function getStore() {
return store;
},
getState: function getState() {
return stateExtractor(store.getState());
},
"do": function _do(actions) {
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
actions = actions.reverse();
var dispatch = store.dispatch;
var _dispatchAction = function dispatchAction() {
console.info("There are other ".concat(actions.length, " actions on stack"));
if (actions.length === 0) return;
dispatch(actions.pop());
if (actions.length === 0) return;
setTimeout(_dispatchAction, delay);
};
setTimeout(_dispatchAction, 0);
}
});
console.groupCollapsed('KitchenConfigurator');
console.info('KitchenConfigurator is ready');
console.info('console.log(KitchenConfigurator)');
console.log(window.KitchenConfigurator);
console.groupEnd();
};
}