NativeAppState.js 779 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @flow
  8. * @format
  9. */
  10. 'use strict';
  11. import type {TurboModule} from '../TurboModule/RCTExport';
  12. import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
  13. export interface Spec extends TurboModule {
  14. +getConstants: () => {|
  15. initialAppState: string,
  16. |};
  17. +getCurrentAppState: (
  18. success: (appState: {|app_state: string|}) => void,
  19. error: (error: Object) => void,
  20. ) => void;
  21. // Events
  22. +addListener: (eventName: string) => void;
  23. +removeListeners: (count: number) => void;
  24. }
  25. export default (TurboModuleRegistry.getEnforcing<Spec>('AppState'): Spec);