Files
react-native/packages/rn-tester/IntegrationTests/LoggingTestModule.js
Tim Yung 3e6423fe65 RN: Flowify packages/rn-tester (#51788)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51788

Adds `flow` to the remaining files that are lacking it in the `packages/rn-tester` directory.

This also adds any necessary type annotations and fixes lint warnings.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75899307

fbshipit-source-id: 27a74ed0007b3b754446a45931c2c148312d5e3a
2025-06-04 12:03:52 -07:00

38 lines
957 B
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import invariant from 'invariant';
import BatchedBridge from 'react-native/Libraries/BatchedBridge/BatchedBridge';
const LoggingTestModule = {
logToConsole(message: string): void {
console.log(message);
},
logToConsoleAfterWait(message: string, delay: number): void {
setTimeout(function () {
console.log(message);
}, delay);
},
warning(message: string): void {
console.warn(message);
},
invariant(message: string): void {
invariant(false, message);
},
logErrorToConsole(message: string): void {
console.error(message);
},
throwError(message: string): void {
throw new Error(message);
},
};
BatchedBridge.registerCallableModule('LoggingTestModule', LoggingTestModule);