recoil
Version:
Recoil - A state management library for React
46 lines (40 loc) • 1.12 kB
Flow
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+recoil
* @flow strict-local
* @format
*/
const {
batchStart
} = require('../core/Recoil_RecoilValueInterface');
const {
unstable_batchedUpdates
} = require('../util/Recoil_ReactBatchedUpdates');
let batcher = unstable_batchedUpdates; // flowlint-next-line unclear-type:off
type Callback = () => any;
type Batcher = (callback: Callback) => void;
/**
* Sets the provided batcher function as the batcher function used by Recoil.
*
* Set the batcher to a custom batcher for your renderer,
* if you use a renderer other than React DOM or React Native.
*/
declare var setBatcher: (newBatcher: Batcher) => any;
/**
* Returns the current batcher function.
*/
declare var getBatcher: () => any;
/**
* Calls the current batcher function and passes the
* provided callback function.
*/
declare var batchUpdates: (callback: Callback) => any;
module.exports = {
getBatcher,
setBatcher,
batchUpdates
};