-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathdeprecations.ts
More file actions
33 lines (27 loc) · 882 Bytes
/
deprecations.ts
File metadata and controls
33 lines (27 loc) · 882 Bytes
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
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 = /* @__PURE__ */ once(console.warn)
export function deprecateInterpolate() {
warnInterpolate(
`${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`
)
}
const warnDirectCall = /* @__PURE__ */ 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`
)
}