@lynx-js/lynx-library-headers 0.0.1-alpha.4 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/index.js +1 -0
  2. package/package.json +3 -26
  3. package/README.md +0 -53
  4. package/include/base/include/value/lynx_api_types.h +0 -57
  5. package/include/base/include/value/lynx_value_api.h +0 -204
  6. package/include/base/include/value/lynx_value_types.h +0 -73
  7. package/include/capi/lynx_env_capi.h +0 -47
  8. package/include/capi/lynx_event_reporter_service_capi.h +0 -67
  9. package/include/capi/lynx_export.h +0 -27
  10. package/include/capi/lynx_extension_module_capi.h +0 -148
  11. package/include/capi/lynx_extension_module_types_capi.h +0 -17
  12. package/include/capi/lynx_generic_resource_fetcher_capi.h +0 -124
  13. package/include/capi/lynx_group_capi.h +0 -42
  14. package/include/capi/lynx_http_service_capi.h +0 -113
  15. package/include/capi/lynx_load_meta_capi.h +0 -52
  16. package/include/capi/lynx_log_capi.h +0 -69
  17. package/include/capi/lynx_memory_capi.h +0 -28
  18. package/include/capi/lynx_native_module_capi.h +0 -51
  19. package/include/capi/lynx_native_view_capi.h +0 -163
  20. package/include/capi/lynx_resource_request_capi.h +0 -71
  21. package/include/capi/lynx_resource_response_capi.h +0 -92
  22. package/include/capi/lynx_runtime_lifecycle_observer_capi.h +0 -62
  23. package/include/capi/lynx_security_service_capi.h +0 -52
  24. package/include/capi/lynx_service_center_capi.h +0 -50
  25. package/include/capi/lynx_template_bundle_capi.h +0 -39
  26. package/include/capi/lynx_template_data_capi.h +0 -33
  27. package/include/capi/lynx_trace_capi.h +0 -62
  28. package/include/capi/lynx_trail_service_capi.h +0 -35
  29. package/include/capi/lynx_types.h +0 -750
  30. package/include/capi/lynx_update_meta_capi.h +0 -33
  31. package/include/capi/lynx_view_builder_capi.h +0 -113
  32. package/include/capi/lynx_view_capi.h +0 -174
  33. package/include/capi/lynx_view_client_capi.h +0 -81
  34. package/include/capi/lynx_vsync_monitor_capi.h +0 -38
  35. package/include/capi/lynx_windowless_renderer_capi.h +0 -213
  36. package/include/js_native_api.h +0 -608
  37. package/include/js_native_api_types.h +0 -202
  38. package/include/lynx/base/include/value/lynx_api_types.h +0 -57
  39. package/include/lynx/base/include/value/lynx_value_api.h +0 -204
  40. package/include/lynx/base/include/value/lynx_value_types.h +0 -73
  41. package/include/lynx/extension.h +0 -6
  42. package/include/lynx/platform/embedder/public/capi/lynx_env_capi.h +0 -47
  43. package/include/lynx/platform/embedder/public/capi/lynx_event_reporter_service_capi.h +0 -67
  44. package/include/lynx/platform/embedder/public/capi/lynx_export.h +0 -27
  45. package/include/lynx/platform/embedder/public/capi/lynx_extension_module_capi.h +0 -148
  46. package/include/lynx/platform/embedder/public/capi/lynx_extension_module_types_capi.h +0 -17
  47. package/include/lynx/platform/embedder/public/capi/lynx_generic_resource_fetcher_capi.h +0 -124
  48. package/include/lynx/platform/embedder/public/capi/lynx_group_capi.h +0 -42
  49. package/include/lynx/platform/embedder/public/capi/lynx_http_service_capi.h +0 -113
  50. package/include/lynx/platform/embedder/public/capi/lynx_load_meta_capi.h +0 -52
  51. package/include/lynx/platform/embedder/public/capi/lynx_log_capi.h +0 -69
  52. package/include/lynx/platform/embedder/public/capi/lynx_memory_capi.h +0 -28
  53. package/include/lynx/platform/embedder/public/capi/lynx_native_module_capi.h +0 -51
  54. package/include/lynx/platform/embedder/public/capi/lynx_native_view_capi.h +0 -163
  55. package/include/lynx/platform/embedder/public/capi/lynx_resource_request_capi.h +0 -71
  56. package/include/lynx/platform/embedder/public/capi/lynx_resource_response_capi.h +0 -92
  57. package/include/lynx/platform/embedder/public/capi/lynx_runtime_lifecycle_observer_capi.h +0 -62
  58. package/include/lynx/platform/embedder/public/capi/lynx_security_service_capi.h +0 -52
  59. package/include/lynx/platform/embedder/public/capi/lynx_service_center_capi.h +0 -50
  60. package/include/lynx/platform/embedder/public/capi/lynx_template_bundle_capi.h +0 -39
  61. package/include/lynx/platform/embedder/public/capi/lynx_template_data_capi.h +0 -33
  62. package/include/lynx/platform/embedder/public/capi/lynx_trace_capi.h +0 -62
  63. package/include/lynx/platform/embedder/public/capi/lynx_trail_service_capi.h +0 -35
  64. package/include/lynx/platform/embedder/public/capi/lynx_types.h +0 -750
  65. package/include/lynx/platform/embedder/public/capi/lynx_update_meta_capi.h +0 -33
  66. package/include/lynx/platform/embedder/public/capi/lynx_view_builder_capi.h +0 -113
  67. package/include/lynx/platform/embedder/public/capi/lynx_view_capi.h +0 -174
  68. package/include/lynx/platform/embedder/public/capi/lynx_view_client_capi.h +0 -81
  69. package/include/lynx/platform/embedder/public/capi/lynx_vsync_monitor_capi.h +0 -38
  70. package/include/lynx/platform/embedder/public/capi/lynx_windowless_renderer_capi.h +0 -213
  71. package/include/lynx/platform/embedder/public/lynx_env.h +0 -104
  72. package/include/lynx/platform/embedder/public/lynx_event_reporter_service.h +0 -96
  73. package/include/lynx/platform/embedder/public/lynx_event_simulation_proxy.h +0 -31
  74. package/include/lynx/platform/embedder/public/lynx_extension_module.h +0 -521
  75. package/include/lynx/platform/embedder/public/lynx_generic_resource_fetcher.h +0 -178
  76. package/include/lynx/platform/embedder/public/lynx_group.h +0 -70
  77. package/include/lynx/platform/embedder/public/lynx_http_service.h +0 -211
  78. package/include/lynx/platform/embedder/public/lynx_load_meta.h +0 -120
  79. package/include/lynx/platform/embedder/public/lynx_native_module.h +0 -9
  80. package/include/lynx/platform/embedder/public/lynx_native_view.h +0 -201
  81. package/include/lynx/platform/embedder/public/lynx_resource_request.h +0 -56
  82. package/include/lynx/platform/embedder/public/lynx_resource_response.h +0 -63
  83. package/include/lynx/platform/embedder/public/lynx_runtime_lifecycle_observer.h +0 -102
  84. package/include/lynx/platform/embedder/public/lynx_security_service.h +0 -78
  85. package/include/lynx/platform/embedder/public/lynx_service_center.h +0 -64
  86. package/include/lynx/platform/embedder/public/lynx_template_bundle.h +0 -65
  87. package/include/lynx/platform/embedder/public/lynx_template_data.h +0 -104
  88. package/include/lynx/platform/embedder/public/lynx_trail_service.h +0 -81
  89. package/include/lynx/platform/embedder/public/lynx_update_meta.h +0 -56
  90. package/include/lynx/platform/embedder/public/lynx_value.h +0 -270
  91. package/include/lynx/platform/embedder/public/lynx_view.h +0 -364
  92. package/include/lynx/platform/embedder/public/lynx_view_client.h +0 -226
  93. package/include/lynx/platform/embedder/public/lynx_vsync_monitor.h +0 -70
  94. package/include/lynx/platform/embedder/public/lynx_windowless_renderer.h +0 -302
  95. package/include/lynx/registration.h +0 -178
  96. package/include/lynx_env.h +0 -104
  97. package/include/lynx_event_reporter_service.h +0 -96
  98. package/include/lynx_event_simulation_proxy.h +0 -31
  99. package/include/lynx_extension.h +0 -10
  100. package/include/lynx_extension_module.h +0 -521
  101. package/include/lynx_generic_resource_fetcher.h +0 -178
  102. package/include/lynx_group.h +0 -70
  103. package/include/lynx_http_service.h +0 -211
  104. package/include/lynx_load_meta.h +0 -120
  105. package/include/lynx_native_module.h +0 -9
  106. package/include/lynx_native_view.h +0 -201
  107. package/include/lynx_resource_request.h +0 -56
  108. package/include/lynx_resource_response.h +0 -63
  109. package/include/lynx_runtime_lifecycle_observer.h +0 -102
  110. package/include/lynx_security_service.h +0 -78
  111. package/include/lynx_service_center.h +0 -64
  112. package/include/lynx_template_bundle.h +0 -65
  113. package/include/lynx_template_data.h +0 -104
  114. package/include/lynx_trail_service.h +0 -81
  115. package/include/lynx_update_meta.h +0 -56
  116. package/include/lynx_value.h +0 -270
  117. package/include/lynx_view.h +0 -364
  118. package/include/lynx_view_client.h +0 -226
  119. package/include/lynx_vsync_monitor.h +0 -70
  120. package/include/lynx_windowless_renderer.h +0 -302
  121. package/include/napi-inl.deprecated.h +0 -186
  122. package/include/napi-inl.h +0 -6607
  123. package/include/napi.h +0 -3208
  124. package/include/node_api.h +0 -276
  125. package/include/node_api_types.h +0 -59
  126. package/include/third_party/weak-node-api/headers/js_native_api.h +0 -608
  127. package/include/third_party/weak-node-api/headers/js_native_api_types.h +0 -202
  128. package/include/third_party/weak-node-api/headers/napi-inl.deprecated.h +0 -186
  129. package/include/third_party/weak-node-api/headers/napi-inl.h +0 -6607
  130. package/include/third_party/weak-node-api/headers/napi.h +0 -3208
  131. package/include/third_party/weak-node-api/headers/node_api.h +0 -276
  132. package/include/third_party/weak-node-api/headers/node_api_types.h +0 -59
  133. package/include/third_party/weak-node-api/headers/weak_napi_defines.h +0 -331
  134. package/include/third_party/weak-node-api/headers/weak_napi_undefs.h +0 -282
  135. package/include/weak_napi_defines.h +0 -331
  136. package/include/weak_napi_undefs.h +0 -282
@@ -1,178 +0,0 @@
1
- #ifndef LYNX_EXTENSION_HEADERS_LYNX_REGISTRATION_H_
2
- #define LYNX_EXTENSION_HEADERS_LYNX_REGISTRATION_H_
3
-
4
- #include <node_api.h>
5
-
6
- #if __has_include(<lynx_extension.h>)
7
- #include <lynx_extension.h>
8
- #elif __has_include(<lynx/extension.h>)
9
- #include <lynx/extension.h>
10
- #endif
11
-
12
- #include <stdint.h>
13
-
14
- namespace lynx {
15
- namespace registration {
16
-
17
- #if defined(USE_WEAK_SUFFIX_NAPI)
18
- #include "third_party/weak-node-api/headers/weak_napi_defines.h"
19
- using LynxNapiEnv = napi_env;
20
- using LynxNapiValue = napi_value;
21
- using LynxNativeModuleCreator = napi_module_creator;
22
- #else
23
- using LynxNapiEnv = napi_env;
24
- using LynxNapiValue = napi_value;
25
- using LynxNativeModuleCreator = napi_module_creator;
26
- #endif
27
-
28
- struct ElementRegistration {
29
- const char* module_name;
30
- const char* element_name;
31
- lynx_native_view_creator create_native_view;
32
- bool is_lazy_create;
33
- void* opaque;
34
- };
35
-
36
- inline void Check(napi_env env, napi_status status) {
37
- if (status != napi_ok) {
38
- napi_throw_error(env, nullptr, "N-API call failed");
39
- }
40
- }
41
-
42
- inline void OnRuntimeInit(lynx_extension_module_t* module) {
43
- (void)module;
44
- }
45
-
46
- inline void OnRuntimeAttach(lynx_extension_module_t* module,
47
- napi_env env,
48
- lynx_vsync_observer_t* vsync_observer) {
49
- (void)module;
50
- (void)env;
51
- (void)vsync_observer;
52
- }
53
-
54
- inline void RegisterNativeView(lynx_extension_module_t* module,
55
- lynx_view_t* lynx_view) {
56
- if (module == nullptr || lynx_view == nullptr) {
57
- return;
58
- }
59
-
60
- auto* registration = static_cast<ElementRegistration*>(
61
- lynx_extension_module_get_user_data(module));
62
-
63
- if (registration != nullptr && registration->element_name != nullptr &&
64
- registration->create_native_view != nullptr) {
65
- // Keep explicit opaque values, otherwise pass the current LynxView so
66
- // native UI implementations can resolve their platform parent window.
67
- void* native_view_opaque =
68
- registration->opaque != nullptr ? registration->opaque : lynx_view;
69
- lynx_view_register_native_view(lynx_view, registration->element_name,
70
- registration->create_native_view,
71
- native_view_opaque);
72
- }
73
- }
74
-
75
- inline lynx_extension_module_t* CreateElementModule(void* opaque) {
76
- auto* registration = static_cast<ElementRegistration*>(opaque);
77
- lynx_extension_module_t* module = lynx_extension_module_create(registration);
78
- lynx_extension_module_bind_runtime_init(module, OnRuntimeInit);
79
- lynx_extension_module_bind_runtime_attach(module, OnRuntimeAttach);
80
- lynx_extension_module_bind_lynx_view_create(module, RegisterNativeView);
81
- return module;
82
- }
83
-
84
- inline void RegisterNativeModule(const char* name,
85
- LynxNativeModuleCreator creator,
86
- void* opaque) {
87
- if (name == nullptr || creator == nullptr) {
88
- return;
89
- }
90
- lynx_env_register_native_module(name, creator, opaque);
91
- }
92
-
93
- inline void RegisterElement(ElementRegistration* registration) {
94
- if (registration == nullptr || registration->module_name == nullptr ||
95
- registration->element_name == nullptr ||
96
- registration->create_native_view == nullptr) {
97
- return;
98
- }
99
- lynx_env_register_extension_module(
100
- registration->module_name, CreateElementModule,
101
- registration->is_lazy_create, registration);
102
- }
103
-
104
- } // namespace registration
105
- } // namespace lynx
106
-
107
- #if defined(_MSC_VER)
108
- #define LYNX_REGISTRATION_CONSTRUCTOR(NAME) \
109
- static void NAME(void); \
110
- namespace { \
111
- struct NAME##Constructor { \
112
- NAME##Constructor() { \
113
- NAME(); \
114
- } \
115
- } NAME##ConstructorInstance; \
116
- } \
117
- static void NAME(void)
118
- #else
119
- #define LYNX_REGISTRATION_CONSTRUCTOR(NAME) \
120
- __attribute__((constructor)) static void NAME(void)
121
- #endif
122
-
123
- #define LYNX_REGISTRATION_CONCAT_INNER(A, B) A##B
124
- #define LYNX_REGISTRATION_CONCAT(A, B) LYNX_REGISTRATION_CONCAT_INNER(A, B)
125
-
126
- #define LYNX_REGISTER_NATIVE_MODULE(NAME, CREATE_NATIVE_MODULE, OPAQUE) \
127
- LYNX_REGISTRATION_REGISTER_NATIVE_MODULE_UNIQUE(NAME, CREATE_NATIVE_MODULE, \
128
- OPAQUE, __COUNTER__)
129
-
130
- #define LYNX_REGISTRATION_REGISTER_NATIVE_MODULE_UNIQUE( \
131
- NAME, CREATE_NATIVE_MODULE, OPAQUE, ID) \
132
- LYNX_REGISTRATION_REGISTER_NATIVE_MODULE_DISPATCH( \
133
- NAME, CREATE_NATIVE_MODULE, OPAQUE, \
134
- LYNX_REGISTRATION_CONCAT(LynxNativeModule, ID))
135
-
136
- #define LYNX_REGISTRATION_REGISTER_NATIVE_MODULE_DISPATCH( \
137
- NAME, CREATE_NATIVE_MODULE, OPAQUE, ID) \
138
- LYNX_REGISTRATION_REGISTER_NATIVE_MODULE_IMPL(NAME, CREATE_NATIVE_MODULE, \
139
- OPAQUE, ID)
140
-
141
- #define LYNX_REGISTRATION_REGISTER_NATIVE_MODULE_IMPL( \
142
- NAME, CREATE_NATIVE_MODULE, OPAQUE, ID) \
143
- namespace { \
144
- LYNX_REGISTRATION_CONSTRUCTOR(ID##Register) { \
145
- ::lynx::registration::RegisterNativeModule(NAME, CREATE_NATIVE_MODULE, \
146
- OPAQUE); \
147
- } \
148
- }
149
-
150
- #define LYNX_REGISTER_ELEMENT(MODULE_NAME, ELEMENT_NAME, CREATE_NATIVE_VIEW, \
151
- IS_LAZY_CREATE, OPAQUE) \
152
- LYNX_REGISTRATION_REGISTER_ELEMENT_UNIQUE( \
153
- MODULE_NAME, ELEMENT_NAME, CREATE_NATIVE_VIEW, IS_LAZY_CREATE, OPAQUE, \
154
- __COUNTER__)
155
-
156
- #define LYNX_REGISTRATION_REGISTER_ELEMENT_UNIQUE( \
157
- MODULE_NAME, ELEMENT_NAME, CREATE_NATIVE_VIEW, IS_LAZY_CREATE, OPAQUE, ID) \
158
- LYNX_REGISTRATION_REGISTER_ELEMENT_DISPATCH( \
159
- MODULE_NAME, ELEMENT_NAME, CREATE_NATIVE_VIEW, IS_LAZY_CREATE, OPAQUE, \
160
- LYNX_REGISTRATION_CONCAT(LynxElementModule, ID))
161
-
162
- #define LYNX_REGISTRATION_REGISTER_ELEMENT_DISPATCH( \
163
- MODULE_NAME, ELEMENT_NAME, CREATE_NATIVE_VIEW, IS_LAZY_CREATE, OPAQUE, ID) \
164
- LYNX_REGISTRATION_REGISTER_ELEMENT_IMPL(MODULE_NAME, ELEMENT_NAME, \
165
- CREATE_NATIVE_VIEW, IS_LAZY_CREATE, \
166
- OPAQUE, ID)
167
-
168
- #define LYNX_REGISTRATION_REGISTER_ELEMENT_IMPL( \
169
- MODULE_NAME, ELEMENT_NAME, CREATE_NATIVE_VIEW, IS_LAZY_CREATE, OPAQUE, ID) \
170
- namespace { \
171
- ::lynx::registration::ElementRegistration ID##Registration = { \
172
- MODULE_NAME, ELEMENT_NAME, CREATE_NATIVE_VIEW, IS_LAZY_CREATE, OPAQUE}; \
173
- LYNX_REGISTRATION_CONSTRUCTOR(ID##Register) { \
174
- ::lynx::registration::RegisterElement(&ID##Registration); \
175
- } \
176
- }
177
-
178
- #endif // LYNX_EXTENSION_HEADERS_LYNX_REGISTRATION_H_
@@ -1,104 +0,0 @@
1
- // Copyright 2025 The Lynx Authors. All rights reserved.
2
- // Licensed under the Apache License Version 2.0 that can be found in the
3
- // LICENSE file in the root directory of this source tree.
4
- #ifndef PLATFORM_EMBEDDER_PUBLIC_LYNX_ENV_H_
5
- #define PLATFORM_EMBEDDER_PUBLIC_LYNX_ENV_H_
6
-
7
- #include <string>
8
- #include <unordered_map>
9
-
10
- #include "capi/lynx_env_capi.h"
11
- #include "lynx_native_module.h"
12
-
13
- namespace lynx {
14
- namespace pub {
15
-
16
- class LynxEnv {
17
- public:
18
- static LynxEnv& GetInstance();
19
- const char* GetVersion();
20
- void SetICUDataPath(const char* icu_data_path);
21
- const char* GetICUDataPath() const;
22
-
23
- void SetDevtoolAppInfo(const char* name, const char* value);
24
- void SetDevtoolEnabled(bool enable);
25
- bool IsDevtoolEnabled();
26
- bool ConnectDevtool(const char* url);
27
- void SetOpenCardCallback(lynx_env_open_card_callback callback,
28
- void* user_data);
29
- void SetLogboxEnabled(bool enable);
30
- bool IsLogboxEnabled();
31
- void RegisterNativeModule(const std::string& module_name,
32
- napi_module_creator creator, void* opaque);
33
- void RegisterExtensionModule(const std::string& module_name,
34
- extension_module_creator creator,
35
- bool is_lazy_create, void* opaque);
36
-
37
- LynxEnv(const LynxEnv&) = delete;
38
- LynxEnv& operator=(const LynxEnv&) = delete;
39
-
40
- private:
41
- LynxEnv() = default;
42
- ~LynxEnv() = default;
43
- };
44
-
45
- inline LynxEnv& LynxEnv::GetInstance() {
46
- static LynxEnv instance;
47
- return instance;
48
- }
49
-
50
- inline const char* LynxEnv::GetVersion() { return lynx_env_get_sdk_version(); }
51
-
52
- inline void LynxEnv::SetICUDataPath(const char* icu_data_path) {
53
- lynx_env_set_icu_data_path(icu_data_path);
54
- }
55
-
56
- inline const char* LynxEnv::GetICUDataPath() const {
57
- return lynx_env_get_icu_data_path();
58
- }
59
-
60
- inline void LynxEnv::SetDevtoolAppInfo(const char* name, const char* value) {
61
- lynx_env_set_devtool_app_info(name, value);
62
- }
63
-
64
- inline void LynxEnv::SetDevtoolEnabled(bool enable) {
65
- lynx_env_enable_devtool(enable);
66
- }
67
-
68
- inline bool LynxEnv::IsDevtoolEnabled() {
69
- return lynx_env_is_devtool_enabled();
70
- }
71
-
72
- inline bool LynxEnv::ConnectDevtool(const char* url) {
73
- return lynx_env_connect_devtool(url);
74
- }
75
-
76
- inline void LynxEnv::SetOpenCardCallback(lynx_env_open_card_callback callback,
77
- void* user_data) {
78
- lynx_env_set_open_card_callback(callback, user_data);
79
- }
80
-
81
- inline void LynxEnv::SetLogboxEnabled(bool enable) {
82
- lynx_env_enable_logbox(enable);
83
- }
84
-
85
- inline bool LynxEnv::IsLogboxEnabled() { return lynx_env_is_logbox_enabled(); }
86
-
87
- inline void LynxEnv::RegisterNativeModule(const std::string& module_name,
88
- napi_module_creator creator,
89
- void* opaque) {
90
- lynx_env_register_native_module(module_name.c_str(), creator, opaque);
91
- }
92
-
93
- inline void LynxEnv::RegisterExtensionModule(const std::string& module_name,
94
- extension_module_creator creator,
95
- bool is_lazy_create,
96
- void* opaque) {
97
- lynx_env_register_extension_module(module_name.c_str(), creator,
98
- is_lazy_create, opaque);
99
- }
100
-
101
- } // namespace pub
102
- } // namespace lynx
103
-
104
- #endif // PLATFORM_EMBEDDER_PUBLIC_LYNX_ENV_H_
@@ -1,96 +0,0 @@
1
- // Copyright 2025 The Lynx Authors. All rights reserved.
2
- // Licensed under the Apache License Version 2.0 that can be found in the
3
- // LICENSE file in the root directory of this source tree.
4
- #ifndef PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_REPORTER_SERVICE_H_
5
- #define PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_REPORTER_SERVICE_H_
6
-
7
- #include <cstdint>
8
- #include <memory>
9
- #include <string>
10
- #include <unordered_map>
11
- #include <vector>
12
-
13
- #include "capi/lynx_event_reporter_service_capi.h"
14
- #include "capi/lynx_service_center_capi.h"
15
- #include "lynx/base/include/value/lynx_api_types.h"
16
- #include "lynx_service_center.h"
17
-
18
- namespace lynx {
19
- namespace pub {
20
-
21
- class LynxEventReporterService
22
- : public LynxServiceBase,
23
- public std::enable_shared_from_this<LynxEventReporterService> {
24
- public:
25
- LynxEventReporterService() = default;
26
- ~LynxEventReporterService() = default;
27
-
28
- void InitIfNeeded() override {
29
- if (event_reporter_service_) {
30
- return;
31
- }
32
- event_reporter_service_ = lynx_event_reporter_service_create_with_finalizer(
33
- new std::weak_ptr<LynxEventReporterService>(weak_from_this()),
34
- [](lynx_event_reporter_service_t* event_reporter_service,
35
- void* user_data) {
36
- std::weak_ptr<LynxEventReporterService>* weak_ptr =
37
- reinterpret_cast<std::weak_ptr<LynxEventReporterService>*>(
38
- user_data);
39
- delete weak_ptr;
40
- });
41
- lynx_event_reporter_service_bind(
42
- event_reporter_service_,
43
- [](lynx_event_reporter_service_t* event_reporter_service,
44
- const char* event_name, const lynx_value& params) {
45
- std::weak_ptr<LynxEventReporterService>* weak_ptr =
46
- reinterpret_cast<std::weak_ptr<LynxEventReporterService>*>(
47
- lynx_event_reporter_service_get_user_data(
48
- event_reporter_service));
49
- auto shared_event_reporter_service = weak_ptr->lock();
50
- if (shared_event_reporter_service) {
51
- shared_event_reporter_service->OnEvent(event_name, params);
52
- }
53
- });
54
-
55
- lynx_event_reporter_service_bind_performance_report_func(
56
- event_reporter_service_,
57
- [](lynx_event_reporter_service_t* event_reporter_service,
58
- const lynx_value& params) {
59
- std::weak_ptr<LynxEventReporterService>* weak_ptr =
60
- reinterpret_cast<std::weak_ptr<LynxEventReporterService>*>(
61
- lynx_event_reporter_service_get_user_data(
62
- event_reporter_service));
63
- auto shared_event_reporter_service = weak_ptr->lock();
64
- if (shared_event_reporter_service) {
65
- shared_event_reporter_service->OnPerformanceEvent(params);
66
- }
67
- });
68
- }
69
-
70
- lynx_service_type_e GetServiceType() override {
71
- return kServiceTypeEventReporter;
72
- }
73
-
74
- void* Impl() override { return event_reporter_service_; }
75
-
76
- /**
77
- * @brief Interface to receive reported events
78
- * @param event_name Name of reported event
79
- * @param props Content of reported event in key-value format
80
- */
81
- virtual void OnEvent(const std::string& event_name,
82
- const lynx_value& params) = 0;
83
-
84
- /**
85
- * @brief Interface to receive reported performance events
86
- * @param params Content of reported event in key-value format
87
- */
88
- virtual void OnPerformanceEvent(const lynx_value& params) {}
89
-
90
- private:
91
- lynx_event_reporter_service_t* event_reporter_service_ = nullptr;
92
- };
93
- } // namespace pub
94
- } // namespace lynx
95
-
96
- #endif // PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_REPORTER_SERVICE_H_
@@ -1,31 +0,0 @@
1
- // Copyright 2025 The Lynx Authors. All rights reserved.
2
- // Licensed under the Apache License Version 2.0 that can be found in the
3
- // LICENSE file in the root directory of this source tree.
4
-
5
- #ifndef PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_SIMULATION_PROXY_H_
6
- #define PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_SIMULATION_PROXY_H_
7
-
8
- #include <string>
9
-
10
- namespace lynx {
11
- namespace pub {
12
-
13
- class LynxEventSimulationProxy {
14
- public:
15
- static constexpr const char* kMousePressed = "mousePressed";
16
- static constexpr const char* kMouseMoved = "mouseMoved";
17
- static constexpr const char* kMouseReleased = "mouseReleased";
18
- static constexpr const char* kMouseWheel = "mouseWheel";
19
- static constexpr const char* kMouseLeftButton = "left";
20
- static constexpr const char* kMouseRightButton = "right";
21
-
22
- virtual ~LynxEventSimulationProxy() = default;
23
- virtual void EmulateTouch(const std::string& event_type, int x, int y,
24
- const std::string& button, float delta_x,
25
- float delta_y, int modifiers, int click_count) = 0;
26
- };
27
-
28
- } // namespace pub
29
- } // namespace lynx
30
-
31
- #endif // PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_SIMULATION_PROXY_H_
@@ -1,10 +0,0 @@
1
- #ifndef LYNX_EXTENSION_HEADERS_LYNX_EXTENSION_H_
2
- #define LYNX_EXTENSION_HEADERS_LYNX_EXTENSION_H_
3
-
4
- #include "capi/lynx_extension_module_capi.h"
5
- #include "capi/lynx_extension_module_types_capi.h"
6
- #include "capi/lynx_env_capi.h"
7
- #include "capi/lynx_native_module_capi.h"
8
- #include "capi/lynx_native_view_capi.h"
9
-
10
- #endif // LYNX_EXTENSION_HEADERS_LYNX_EXTENSION_H_