<commit_before>/**
 * 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.
 *
 * @flow strict
 * @format
 */

'use strict';

import type {TurboModule} from '../../TurboModule/RCTExport';
import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
  +addListener: (eventName: string) => void;
  +removeListeners: (count: number) => void;
}

export default (TurboModuleRegistry.get<Spec>(
  'TVNavigationEventEmitter',
): ?Spec);<commit_msg>Lazily create NativeTVNavigationEventEmitter<commit_after>/**
 * 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.
 *
 * @flow strict
 * @format
 */

'use strict';

import type {TurboModule} from '../../TurboModule/RCTExport';
import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
  +addListener: (eventName: string) => void;
  +removeListeners: (count: number) => void;
}

let NativeModule: ?Spec = null;

const wrapperModule = {
  addListener(eventName: string) {
    if (NativeModule == null) {
      NativeModule = TurboModuleRegistry.get<Spec>('TVNavigationEventEmitter');
    }
    NativeModule && NativeModule.addListener(eventName);
  },

  removeListeners(count: number) {
    if (NativeModule == null) {
      NativeModule = TurboModuleRegistry.get<Spec>('TVNavigationEventEmitter');
    }
    NativeModule && NativeModule.removeListeners(count);
  },
};

export default wrapperModule;
{'fraction_non_alphanumeric': 0.12216404886561955, 'fraction_numerical': 0.0, 'mean_word_length': 4.408805031446541, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1461758', 'n_tokens_mistral': 484, 'n_tokens_neox': 494, 'n_words': 149}