File size: 850 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
declare const console: any

export const prefix = 'react-spring: '

export const once = <TFunc extends (...args: any) => any>(fn: TFunc) => {
  const func = fn
  let called = false

  if (typeof func != 'function') {
    throw new TypeError(`${prefix}once requires a function parameter`)
  }

  return (...args: any) => {
    if (!called) {
      func(...args)
      called = true
    }
  }
}

const warnInterpolate = once(console.warn)
export function deprecateInterpolate() {
  warnInterpolate(
    `${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`
  )
}

const warnDirectCall = once(console.warn)
export function deprecateDirectCall() {
  warnDirectCall(
    `${prefix}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`
  )
}