MCPcopy
hub / github.com/mobxjs/mobx / withConsole

Function withConsole

packages/mobx-react/__tests__/utils/withConsole.ts:7–22  ·  view source on GitHub ↗
(...args: Array<any>)

Source from the content-addressed store, hash-verified

5export function withConsole(props: Array<ConsoleProps>, fn: Function): void
6
7export function withConsole(...args: Array<any>): void {
8 let settings
9 let fn
10 if (typeof args[0] === "function") {
11 fn = args[0]
12 } else if (Array.isArray(args[0]) || typeof args[0] === "object") {
13 settings = args[0]
14
15 if (typeof args[1] === "function") {
16 fn = args[1]
17 }
18 }
19 const restoreConsole = mockConsole(settings)
20 fn && fn()
21 restoreConsole()
22}

Callers 5

Provider.test.tsxFile · 0.90
issue806.test.tsxFile · 0.90
observer.test.tsxFile · 0.90
context.test.tsxFile · 0.90
inject.test.tsxFile · 0.90

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…