jiuyiUniapp/service/node_modules/react-native/ReactCommon/react/utils/jsi-utils.h

32 lines
871 B
C
Raw Normal View History

2025-02-13 09:59:20 +08:00
/*
* 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.
*/
#pragma once
#include <jsi/jsi.h>
#include <string>
namespace facebook::react {
/**
* Defines a property on the global object that is neither enumerable, nor
* configurable, nor writable. This ensures that the private globals exposed by
* ReactInstance cannot overwritten by third-party JavaScript code. It also
* ensures that third-party JavaScript code unaware of these globals isn't able
* to accidentally access them. In JavaScript, equivalent to:
*
* Object.defineProperty(global, propName, {
* value: value
* })
*/
void defineReadOnlyGlobal(
jsi::Runtime& runtime,
const std::string& propName,
jsi::Value&& value);
} // namespace facebook::react