/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/Libraries/Blob/BlobRegistry.js
37 строк
749 B
Iwo Plaza
Migrated files in `Libraries/Blob` to use `export` syntax. (#48761)
21 янв 2025, 12:41
21 янв 2025, 12:41
9a70bc0
Код
Авторство
О чём код?
/** * 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 * @format */ const registry: Map<string, number> = new Map(); export const register = (id: string) => { const used = registry.get(id); if (used != null) { registry.set(id, used + 1); } else { registry.set(id, 1); } }; export const unregister = (id: string) => { const used = registry.get(id); if (used != null) { if (used <= 1) { registry.delete(id); } else { registry.set(id, used - 1); } } }; export const has = (id: string): number | boolean => { return registry.get(id) || false; };