/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/internal-test-utils/enqueueTask.js
20 строк
516 B
Jan Kassens
Update Flow to 0.265 (#34270)
22 авг 2025, 22:22
Не верифицирован
22 авг 2025, 22:22
d260b0d
Код
Авторство
О чём код?
/** * 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 */ const {MessageChannel} = require('node:worker_threads'); export default function enqueueTask(task: () => void): void { const channel = new MessageChannel(); // $FlowFixMe[prop-missing] channel.port1.onmessage = () => { channel.port1.close(); task(); }; channel.port2.postMessage(undefined); }