@@ -4,36 +4,36 @@ import { scheduleMicrotask } from './utils'
44
55type NotifyCallback = ( ) => void
66
7- type UpdateFunction = ( callback : ( ) => void ) => void
7+ type NotifyFunction = ( callback : ( ) => void ) => void
88
9- type BatchUpdatesFunction = ( callback : ( ) => void ) => void
9+ type BatchNotifyFunction = ( callback : ( ) => void ) => void
1010
1111// GETTERS AND SETTERS
1212
13- // Default to a dummy "update " implementation that just runs the callback
14- let updateFn : UpdateFunction = ( callback : ( ) => void ) => {
13+ // Default to a dummy "notify " implementation that just runs the callback
14+ let notifyFn : NotifyFunction = ( callback : ( ) => void ) => {
1515 callback ( )
1616}
1717
18- // Default to a dummy "batch update " implementation that just runs the callback
19- let batchUpdatesFn : BatchUpdatesFunction = ( callback : ( ) => void ) => {
18+ // Default to a dummy "batch notify " implementation that just runs the callback
19+ let batchNotifyFn : BatchNotifyFunction = ( callback : ( ) => void ) => {
2020 callback ( )
2121}
2222
2323/**
24- * Use this function to set a custom update function.
25- * This can be used to for example wrap updates with `React.act` while running tests.
24+ * Use this function to set a custom notify function.
25+ * This can be used to for example wrap notifications with `React.act` while running tests.
2626 */
27- export function setUpdateFn ( fn : UpdateFunction ) {
28- updateFn = fn
27+ export function setNotifyFn ( fn : NotifyFunction ) {
28+ notifyFn = fn
2929}
3030
3131/**
32- * Use this function to set a custom batch function to batch updates together into a single render pass .
32+ * Use this function to set a custom function to batch notifications together into a single tick .
3333 * By default React Query will use the batch function provided by ReactDOM or React Native.
3434 */
35- export function setBatchUpdatesFn ( fn : BatchUpdatesFunction ) {
36- batchUpdatesFn = fn
35+ export function setBatchNotifyFn ( fn : BatchNotifyFunction ) {
36+ batchNotifyFn = fn
3737}
3838
3939// CLASS
@@ -57,12 +57,12 @@ class NotifyManager {
5757 return result
5858 }
5959
60- schedule ( notify : NotifyCallback ) : void {
60+ schedule ( callback : NotifyCallback ) : void {
6161 if ( this . transactions ) {
62- this . queue . push ( notify )
62+ this . queue . push ( callback )
6363 } else {
6464 scheduleMicrotask ( ( ) => {
65- updateFn ( notify )
65+ notifyFn ( callback )
6666 } )
6767 }
6868 }
@@ -72,9 +72,9 @@ class NotifyManager {
7272 this . queue = [ ]
7373 if ( queue . length ) {
7474 scheduleMicrotask ( ( ) => {
75- batchUpdatesFn ( ( ) => {
76- queue . forEach ( notify => {
77- updateFn ( notify )
75+ batchNotifyFn ( ( ) => {
76+ queue . forEach ( callback => {
77+ notifyFn ( callback )
7878 } )
7979 } )
8080 } )
0 commit comments