guardia-messenger/node_modules/expo-modules-core/common/cpp/LazyObject.h
DESKTOP-TKLFCPRython f29f525c77 refactor: 101.79.17.164 → zioinfo.co.kr 전체 도메인 변환 + Manager UI 배포
- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스)
- Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포
- 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:09:17 +09:00

57 lines
1.5 KiB
C++

// Copyright 2022-present 650 Industries. All rights reserved.
#pragma once
#ifdef __cplusplus
#include <jsi/jsi.h>
namespace jsi = facebook::jsi;
namespace expo {
/**
A function that is responsible for initializing the backed object.
*/
typedef std::function<std::shared_ptr<jsi::Object>(jsi::Runtime &)> LazyObjectInitializer;
/**
A host object that defers the creating of the raw object until any property is accessed for the first time.
*/
class JSI_EXPORT LazyObject : public jsi::HostObject {
public:
using Shared = std::shared_ptr<LazyObject>;
LazyObject(const LazyObjectInitializer initializer);
virtual ~LazyObject();
jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
void set(jsi::Runtime &, const jsi::PropNameID &name, const jsi::Value &value) override;
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
/**
If the given object is a host object of type `LazyObject`, it returns its backed object.
Otherwise, the given object is returned back.
*/
static const jsi::Object &unwrapObjectIfNecessary(jsi::Runtime &runtime, const jsi::Object &object);
private:
const LazyObjectInitializer initializer;
std::shared_ptr<jsi::Object> backedObject;
/**
Initializes the backed object. It shouldn't be invoked more than once, so first make sure that `backedObject` is a null pointer.
*/
inline void initializeBackedObject(jsi::Runtime &runtime) {
backedObject = initializer(runtime);
}
}; // class LazyObject
} // namespace expo
#endif // __cplusplus