MCPcopy
hub / github.com/vercel/next.js / with

Method with

packages/next/src/server/lib/trace/tracer.test.ts:35–48  ·  view source on GitHub ↗
(
    newContext: Context,
    fn: F,
    thisArg?: ThisParameterType<F>,
    ...args: A
  )

Source from the content-addressed store, hash-verified

33 }
34
35 with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(
36 newContext: Context,
37 fn: F,
38 thisArg?: ThisParameterType<F>,
39 ...args: A
40 ): ReturnType<F> {
41 const previousContext = this.currentContext
42 this.currentContext = newContext
43 try {
44 return fn.apply(thisArg, args)
45 } finally {
46 this.currentContext = previousContext
47 }
48 }
49
50 bind<T>(bindContext: Context, target: T): T {
51 if (typeof target !== 'function') {

Callers 5

bindMethod · 0.95
withPropagatedContextMethod · 0.45
traceMethod · 0.45
withSpanMethod · 0.45
tracer.test.tsFile · 0.45

Calls 1

applyMethod · 0.45

Tested by

no test coverage detected