Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from "react"
import { ActionTypes, reducer, globalScope } from "react-async"
import { Root, Range, Checkbox, Label, Small, Ol, Li, Button } from "./components"
const storage = globalScope.sessionStorage
const state = {
intercept: (storage && storage.getItem("intercept") === "true") || false,
latency: (storage && storage.getItem("latency")) || "0",
update: () => {},
}
globalScope.__REACT_ASYNC__.devToolsDispatcher = (action, dispatch) => {
const run = () => {
dispatch(action)
state.update(action)
}
switch (action.type) {
case ActionTypes.start:
if (state.intercept) {
dispatch({ ...action, payload: undefined })
state.update(action, run)
} else run()
break
case ActionTypes.fulfill:
case ActionTypes.reject:
setTimeout(run, state.latency * 1000)
break
default: