UNPKG

reactotron-redux

Version:
22 lines (18 loc) 667 B
import type { ReactotronCore } from "reactotron-core-client" export default function createSendAction<Client extends ReactotronCore = ReactotronCore>( reactotron: Client ) { return (action: { type: any }, ms: number, important = false, diff?: any) => { // let's call the type, name because that's "generic" name in Reactotron let { type: name } = action // convert from symbol to type if necessary if (typeof name === "symbol") { name = name .toString() .replace(/^Symbol\(/, "") .replace(/\)$/, "") } // off ya go! reactotron.send("state.action.complete", { name, action, ms, diff }, important) } }