@react-native-ohos/react-native-webview 13.10.5-rc.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 (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/harmony/rn_webview/BuildProfile.ets +41 -0
  4. package/harmony/rn_webview/LICENSE +21 -0
  5. package/harmony/rn_webview/NOTICE +33 -0
  6. package/harmony/rn_webview/OAT.xml +45 -0
  7. package/harmony/rn_webview/README.OpenSource +11 -0
  8. package/harmony/rn_webview/build-profile.json5 +28 -0
  9. package/harmony/rn_webview/consumer-rules.txt +0 -0
  10. package/harmony/rn_webview/hvigorfile.ts +1 -0
  11. package/harmony/rn_webview/index.ets +34 -0
  12. package/harmony/rn_webview/obfuscation-rules.txt +18 -0
  13. package/harmony/rn_webview/oh-package.json5 +13 -0
  14. package/harmony/rn_webview/src/main/cpp/CMakeLists.txt +9 -0
  15. package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +37 -0
  16. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +95 -0
  17. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +126 -0
  18. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +20 -0
  19. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.h +16 -0
  20. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +19 -0
  21. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.h +16 -0
  22. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +22 -0
  23. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +240 -0
  24. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +285 -0
  25. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +151 -0
  26. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +337 -0
  27. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +19 -0
  28. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +34 -0
  29. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +16 -0
  30. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +20 -0
  31. package/harmony/rn_webview/src/main/ets/CutomReference.ts +50 -0
  32. package/harmony/rn_webview/src/main/ets/Logger.ts +64 -0
  33. package/harmony/rn_webview/src/main/ets/Magic.ets +205 -0
  34. package/harmony/rn_webview/src/main/ets/RNCWebView.ets +607 -0
  35. package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +66 -0
  36. package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +68 -0
  37. package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +463 -0
  38. package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +78 -0
  39. package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +509 -0
  40. package/harmony/rn_webview/src/main/ets/generated/components/ts.ts +5 -0
  41. package/harmony/rn_webview/src/main/ets/generated/index.ets +5 -0
  42. package/harmony/rn_webview/src/main/ets/generated/ts.ts +6 -0
  43. package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebView.ts +18 -0
  44. package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebViewModule.ts +16 -0
  45. package/harmony/rn_webview/src/main/ets/generated/turboModules/ts.ts +6 -0
  46. package/harmony/rn_webview/src/main/module.json5 +11 -0
  47. package/harmony/rn_webview/src/main/resources/base/element/string.json +40 -0
  48. package/harmony/rn_webview/src/main/resources/en_US/element/string.json +40 -0
  49. package/harmony/rn_webview/src/main/resources/zh_CN/element/string.json +40 -0
  50. package/harmony/rn_webview/src/test/List.test.ets +5 -0
  51. package/harmony/rn_webview/src/test/LocalUnit.test.ets +33 -0
  52. package/harmony/rn_webview/ts.ets +29 -0
  53. package/harmony/rn_webview.har +0 -0
  54. package/package.json +107 -0
  55. package/src/NativeRNCWebView.ts +16 -0
  56. package/src/NativeRNCWebViewModule.ts +17 -0
  57. package/src/RNCWebViewNativeComponent.ts +286 -0
  58. package/src/WebView.harmony.tsx +330 -0
  59. package/src/WebView.tsx +4 -0
  60. package/src/codegenUtils.ts +9 -0
  61. package/src/index.ts +4 -0
@@ -0,0 +1,509 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ import {
6
+ Descriptor as ComponentDescriptor,
7
+ ViewBaseProps,
8
+ ViewRawProps,
9
+ ViewDescriptorWrapperBase,
10
+ ColorValue,
11
+ Color,
12
+ RNInstance,
13
+ Tag,
14
+ RNComponentCommandReceiver,
15
+ ViewPropsSelector,
16
+ } from '@rnoh/react-native-openharmony/ts';
17
+
18
+
19
+ export namespace RNCWebView {
20
+ export const NAME = "RNCWebView" as const
21
+
22
+ export interface DirectRawProps {
23
+ allowFileAccess?: boolean;
24
+ allowsProtectedMedia?: boolean;
25
+ allowsFullscreenVideo?: boolean;
26
+ androidLayerType?: 'none' | 'software' | 'hardware';
27
+ cacheMode?: 'LOAD_DEFAULT' | 'LOAD_CACHE_ELSE_NETWORK' | 'LOAD_NO_CACHE' | 'LOAD_CACHE_ONLY';
28
+ domStorageEnabled?: boolean;
29
+ downloadingMessage?: string;
30
+ forceDarkOn?: boolean;
31
+ geolocationEnabled?: boolean;
32
+ lackPermissionToDownloadMessage?: string;
33
+ messagingModuleName: string;
34
+ minimumFontSize?: number;
35
+ mixedContentMode?: 'never' | 'always' | 'compatibility';
36
+ nestedScrollEnabled?: boolean;
37
+ overScrollMode?: string;
38
+ saveFormDataDisabled?: boolean;
39
+ scalesPageToFit?: boolean;
40
+ setBuiltInZoomControls?: boolean;
41
+ setDisplayZoomControls?: boolean;
42
+ setSupportMultipleWindows?: boolean;
43
+ textZoom?: number;
44
+ thirdPartyCookiesEnabled?: boolean;
45
+ hasOnScroll?: boolean;
46
+ injectedJavaScriptObject?: string;
47
+ allowingReadAccessToURL?: string;
48
+ allowsBackForwardNavigationGestures?: boolean;
49
+ allowsInlineMediaPlayback?: boolean;
50
+ allowsAirPlayForMediaPlayback?: boolean;
51
+ allowsLinkPreview?: boolean;
52
+ automaticallyAdjustContentInsets?: boolean;
53
+ ignoreSilentHardwareSwitch?: boolean;
54
+ autoManageStatusBarEnabled?: boolean;
55
+ bounces?: boolean;
56
+ contentInset?: unknown;
57
+ contentInsetAdjustmentBehavior?: 'never' | 'automatic' | 'scrollableAxes' | 'always';
58
+ contentMode?: 'recommended' | 'mobile' | 'desktop';
59
+ dataDetectorTypes?: unknown;
60
+ decelerationRate?: number;
61
+ directionalLockEnabled?: boolean;
62
+ enableApplePay?: boolean;
63
+ hideKeyboardAccessoryView?: boolean;
64
+ keyboardDisplayRequiresUserAction?: boolean;
65
+ limitsNavigationsToAppBoundDomains?: boolean;
66
+ mediaCapturePermissionGrantType?: 'prompt' | 'grant' | 'deny' | 'grantIfSameHostElsePrompt' | 'grantIfSameHostElseDeny';
67
+ pagingEnabled?: boolean;
68
+ pullToRefreshEnabled?: boolean;
69
+ scrollEnabled?: boolean;
70
+ sharedCookiesEnabled?: boolean;
71
+ textInteractionEnabled?: boolean;
72
+ useSharedProcessPool?: boolean;
73
+ menuItems?: unknown;
74
+ suppressMenuItems?: unknown[];
75
+ hasOnFileDownload?: boolean;
76
+ fraudulentWebsiteWarningEnabled?: boolean;
77
+ allowFileAccessFromFileURLs?: boolean;
78
+ allowUniversalAccessFromFileURLs?: boolean;
79
+ applicationNameForUserAgent?: string;
80
+ basicAuthCredential?: unknown;
81
+ cacheEnabled?: boolean;
82
+ incognito?: boolean;
83
+ injectedJavaScript?: string;
84
+ injectedJavaScriptBeforeContentLoaded?: string;
85
+ injectedJavaScriptForMainFrameOnly?: boolean;
86
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
87
+ javaScriptCanOpenWindowsAutomatically?: boolean;
88
+ javaScriptEnabled?: boolean;
89
+ webviewDebuggingEnabled?: boolean;
90
+ mediaPlaybackRequiresUserAction?: boolean;
91
+ messagingEnabled: boolean;
92
+ shouldStartLoadWithRequestEnabled: boolean;
93
+ hasOnOpenWindowEvent?: boolean;
94
+ showsHorizontalScrollIndicator?: boolean;
95
+ showsVerticalScrollIndicator?: boolean;
96
+ newSource: unknown;
97
+ userAgent?: string;
98
+ schemeList?: unknown;
99
+ }
100
+
101
+ export interface Props extends ViewBaseProps {}
102
+
103
+ export interface State {}
104
+
105
+ export interface RawProps extends ViewRawProps, DirectRawProps {}
106
+
107
+ export class PropsSelector extends ViewPropsSelector<Props, RawProps> {
108
+ get allowFileAccess() {
109
+ return this.rawProps.allowFileAccess ?? false;
110
+ }
111
+
112
+ get allowsProtectedMedia() {
113
+ return this.rawProps.allowsProtectedMedia ?? false;
114
+ }
115
+
116
+ get allowsFullscreenVideo() {
117
+ return this.rawProps.allowsFullscreenVideo ?? false;
118
+ }
119
+
120
+ get androidLayerType() {
121
+ return this.rawProps.androidLayerType ?? 'none';
122
+ }
123
+
124
+ get cacheMode() {
125
+ return this.rawProps.cacheMode ?? 'LOAD_DEFAULT';
126
+ }
127
+
128
+ get domStorageEnabled() {
129
+ return this.rawProps.domStorageEnabled ?? false;
130
+ }
131
+
132
+ get downloadingMessage() {
133
+ return this.rawProps.downloadingMessage;
134
+ }
135
+
136
+ get forceDarkOn() {
137
+ return this.rawProps.forceDarkOn ?? false;
138
+ }
139
+
140
+ get geolocationEnabled() {
141
+ return this.rawProps.geolocationEnabled ?? false;
142
+ }
143
+
144
+ get lackPermissionToDownloadMessage() {
145
+ return this.rawProps.lackPermissionToDownloadMessage;
146
+ }
147
+
148
+ get messagingModuleName() {
149
+ return this.rawProps.messagingModuleName;
150
+ }
151
+
152
+ get minimumFontSize() {
153
+ return this.rawProps.minimumFontSize ?? 0;
154
+ }
155
+
156
+ get mixedContentMode() {
157
+ return this.rawProps.mixedContentMode ?? 'never';
158
+ }
159
+
160
+ get nestedScrollEnabled() {
161
+ return this.rawProps.nestedScrollEnabled ?? false;
162
+ }
163
+
164
+ get overScrollMode() {
165
+ return this.rawProps.overScrollMode;
166
+ }
167
+
168
+ get saveFormDataDisabled() {
169
+ return this.rawProps.saveFormDataDisabled ?? false;
170
+ }
171
+
172
+ get scalesPageToFit() {
173
+ return this.rawProps.scalesPageToFit ?? false;
174
+ }
175
+
176
+ get setBuiltInZoomControls() {
177
+ return this.rawProps.setBuiltInZoomControls ?? false;
178
+ }
179
+
180
+ get setDisplayZoomControls() {
181
+ return this.rawProps.setDisplayZoomControls ?? false;
182
+ }
183
+
184
+ get setSupportMultipleWindows() {
185
+ return this.rawProps.setSupportMultipleWindows ?? false;
186
+ }
187
+
188
+ get textZoom() {
189
+ return this.rawProps.textZoom ?? 0;
190
+ }
191
+
192
+ get thirdPartyCookiesEnabled() {
193
+ return this.rawProps.thirdPartyCookiesEnabled ?? false;
194
+ }
195
+
196
+ get hasOnScroll() {
197
+ return this.rawProps.hasOnScroll ?? false;
198
+ }
199
+
200
+ get injectedJavaScriptObject() {
201
+ return this.rawProps.injectedJavaScriptObject;
202
+ }
203
+
204
+ get allowingReadAccessToURL() {
205
+ return this.rawProps.allowingReadAccessToURL;
206
+ }
207
+
208
+ get allowsBackForwardNavigationGestures() {
209
+ return this.rawProps.allowsBackForwardNavigationGestures ?? false;
210
+ }
211
+
212
+ get allowsInlineMediaPlayback() {
213
+ return this.rawProps.allowsInlineMediaPlayback ?? false;
214
+ }
215
+
216
+ get allowsAirPlayForMediaPlayback() {
217
+ return this.rawProps.allowsAirPlayForMediaPlayback ?? false;
218
+ }
219
+
220
+ get allowsLinkPreview() {
221
+ return this.rawProps.allowsLinkPreview ?? false;
222
+ }
223
+
224
+ get automaticallyAdjustContentInsets() {
225
+ return this.rawProps.automaticallyAdjustContentInsets ?? false;
226
+ }
227
+
228
+ get ignoreSilentHardwareSwitch() {
229
+ return this.rawProps.ignoreSilentHardwareSwitch ?? false;
230
+ }
231
+
232
+ get autoManageStatusBarEnabled() {
233
+ return this.rawProps.autoManageStatusBarEnabled ?? false;
234
+ }
235
+
236
+ get bounces() {
237
+ return this.rawProps.bounces ?? false;
238
+ }
239
+
240
+ get contentInset() {
241
+ return this.rawProps.contentInset;
242
+ }
243
+
244
+ get contentInsetAdjustmentBehavior() {
245
+ return this.rawProps.contentInsetAdjustmentBehavior ?? 'never';
246
+ }
247
+
248
+ get contentMode() {
249
+ return this.rawProps.contentMode ?? 'recommended';
250
+ }
251
+
252
+ get dataDetectorTypes() {
253
+ return this.rawProps.dataDetectorTypes;
254
+ }
255
+
256
+ get decelerationRate() {
257
+ return this.rawProps.decelerationRate ?? 0;
258
+ }
259
+
260
+ get directionalLockEnabled() {
261
+ return this.rawProps.directionalLockEnabled ?? false;
262
+ }
263
+
264
+ get enableApplePay() {
265
+ return this.rawProps.enableApplePay ?? false;
266
+ }
267
+
268
+ get hideKeyboardAccessoryView() {
269
+ return this.rawProps.hideKeyboardAccessoryView ?? false;
270
+ }
271
+
272
+ get keyboardDisplayRequiresUserAction() {
273
+ return this.rawProps.keyboardDisplayRequiresUserAction ?? false;
274
+ }
275
+
276
+ get limitsNavigationsToAppBoundDomains() {
277
+ return this.rawProps.limitsNavigationsToAppBoundDomains ?? false;
278
+ }
279
+
280
+ get mediaCapturePermissionGrantType() {
281
+ return this.rawProps.mediaCapturePermissionGrantType ?? 'prompt';
282
+ }
283
+
284
+ get pagingEnabled() {
285
+ return this.rawProps.pagingEnabled ?? false;
286
+ }
287
+
288
+ get pullToRefreshEnabled() {
289
+ return this.rawProps.pullToRefreshEnabled ?? false;
290
+ }
291
+
292
+ get scrollEnabled() {
293
+ return this.rawProps.scrollEnabled ?? false;
294
+ }
295
+
296
+ get sharedCookiesEnabled() {
297
+ return this.rawProps.sharedCookiesEnabled ?? false;
298
+ }
299
+
300
+ get textInteractionEnabled() {
301
+ return this.rawProps.textInteractionEnabled ?? false;
302
+ }
303
+
304
+ get useSharedProcessPool() {
305
+ return this.rawProps.useSharedProcessPool ?? false;
306
+ }
307
+
308
+ get menuItems() {
309
+ return this.rawProps.menuItems;
310
+ }
311
+
312
+ get suppressMenuItems() {
313
+ return this.rawProps.suppressMenuItems;
314
+ }
315
+
316
+ get hasOnFileDownload() {
317
+ return this.rawProps.hasOnFileDownload ?? false;
318
+ }
319
+
320
+ get fraudulentWebsiteWarningEnabled() {
321
+ return this.rawProps.fraudulentWebsiteWarningEnabled ?? false;
322
+ }
323
+
324
+ get allowFileAccessFromFileURLs() {
325
+ return this.rawProps.allowFileAccessFromFileURLs ?? false;
326
+ }
327
+
328
+ get allowUniversalAccessFromFileURLs() {
329
+ return this.rawProps.allowUniversalAccessFromFileURLs ?? false;
330
+ }
331
+
332
+ get applicationNameForUserAgent() {
333
+ return this.rawProps.applicationNameForUserAgent;
334
+ }
335
+
336
+ get basicAuthCredential() {
337
+ return this.rawProps.basicAuthCredential;
338
+ }
339
+
340
+ get cacheEnabled() {
341
+ return this.rawProps.cacheEnabled ?? false;
342
+ }
343
+
344
+ get incognito() {
345
+ return this.rawProps.incognito ?? false;
346
+ }
347
+
348
+ get injectedJavaScript() {
349
+ return this.rawProps.injectedJavaScript;
350
+ }
351
+
352
+ get injectedJavaScriptBeforeContentLoaded() {
353
+ return this.rawProps.injectedJavaScriptBeforeContentLoaded;
354
+ }
355
+
356
+ get injectedJavaScriptForMainFrameOnly() {
357
+ return this.rawProps.injectedJavaScriptForMainFrameOnly ?? false;
358
+ }
359
+
360
+ get injectedJavaScriptBeforeContentLoadedForMainFrameOnly() {
361
+ return this.rawProps.injectedJavaScriptBeforeContentLoadedForMainFrameOnly ?? false;
362
+ }
363
+
364
+ get javaScriptCanOpenWindowsAutomatically() {
365
+ return this.rawProps.javaScriptCanOpenWindowsAutomatically ?? false;
366
+ }
367
+
368
+ get javaScriptEnabled() {
369
+ return this.rawProps.javaScriptEnabled ?? false;
370
+ }
371
+
372
+ get webviewDebuggingEnabled() {
373
+ return this.rawProps.webviewDebuggingEnabled ?? false;
374
+ }
375
+
376
+ get mediaPlaybackRequiresUserAction() {
377
+ return this.rawProps.mediaPlaybackRequiresUserAction ?? false;
378
+ }
379
+
380
+ get messagingEnabled() {
381
+ return this.rawProps.messagingEnabled ?? false;
382
+ }
383
+
384
+ get shouldStartLoadWithRequestEnabled() {
385
+ return this.rawProps.shouldStartLoadWithRequestEnabled ?? false;
386
+ }
387
+
388
+ get hasOnOpenWindowEvent() {
389
+ return this.rawProps.hasOnOpenWindowEvent ?? false;
390
+ }
391
+
392
+ get showsHorizontalScrollIndicator() {
393
+ return this.rawProps.showsHorizontalScrollIndicator ?? false;
394
+ }
395
+
396
+ get showsVerticalScrollIndicator() {
397
+ return this.rawProps.showsVerticalScrollIndicator ?? false;
398
+ }
399
+
400
+ get newSource() {
401
+ return this.rawProps.newSource;
402
+ }
403
+
404
+ get userAgent() {
405
+ return this.rawProps.userAgent;
406
+ }
407
+
408
+ get schemeList() {
409
+ return this.rawProps.schemeList;
410
+ }
411
+
412
+
413
+ }
414
+
415
+ export type Descriptor = ComponentDescriptor<
416
+ typeof NAME,
417
+ Props,
418
+ State,
419
+ RawProps
420
+ >;
421
+
422
+ export class DescriptorWrapper extends ViewDescriptorWrapperBase<
423
+ typeof NAME,
424
+ Props,
425
+ State,
426
+ RawProps,
427
+ PropsSelector
428
+ > {
429
+ protected createPropsSelector() {
430
+ return new PropsSelector(this.descriptor.props, this.descriptor.rawProps)
431
+ }
432
+ }
433
+
434
+ export interface EventPayloadByName {
435
+ "contentSizeChange": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number}
436
+ "renderProcessGone": {didCrash: boolean}
437
+ "contentProcessDidTerminate": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number}
438
+ "customMenuSelection": {label: string, key: string, selectedText: string}
439
+ "fileDownload": {downloadUrl: string}
440
+ "loadingError": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, domain?: string, code: number, description: string}
441
+ "loadingFinish": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, navigationType: 'click' | 'formsubmit' | 'backforward' | 'reload' | 'formresubmit' | 'other', mainDocumentURL?: string}
442
+ "loadingProgress": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, progress: number}
443
+ "loadingStart": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, navigationType: 'click' | 'formsubmit' | 'backforward' | 'reload' | 'formresubmit' | 'other', mainDocumentURL?: string}
444
+ "httpError": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, description: string, statusCode: number}
445
+ "message": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, data: string}
446
+ "openWindow": {targetUrl: string}
447
+ "scroll": {contentInset: {bottom: number, left: number, right: number, top: number}, contentOffset: {y: number, x: number}, contentSize: {height: number, width: number}, layoutMeasurement: {height: number, width: number}, targetContentOffset?: {y: number, x: number}, velocity?: {y: number, x: number}, zoomScale?: number, responderIgnoreScroll?: boolean}
448
+ "shouldStartLoadWithRequest": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, navigationType: 'click' | 'formsubmit' | 'backforward' | 'reload' | 'formresubmit' | 'other', mainDocumentURL?: string, isTopFrame: boolean}
449
+ }
450
+
451
+ export class EventEmitter {
452
+ constructor(private rnInstance: RNInstance, private tag: Tag) {}
453
+
454
+ emit<TEventName extends keyof EventPayloadByName>(eventName: TEventName, payload: EventPayloadByName[TEventName]) {
455
+ this.rnInstance.emitComponentEvent(this.tag, eventName, payload)
456
+ }
457
+ }
458
+
459
+ export interface CommandArgvByName {
460
+ "goBack": []
461
+ "goForward": []
462
+ "reload": []
463
+ "stopLoading": []
464
+ "injectJavaScript": [string]
465
+ "requestFocus": []
466
+ "postMessage": [string]
467
+ "loadUrl": [string]
468
+ "clearFormData": []
469
+ "clearCache": [boolean]
470
+ "clearHistory": []
471
+ }
472
+
473
+ export class CommandReceiver {
474
+ private listenersByCommandName = new Map<string, Set<(...args: any[]) => void>>()
475
+ private cleanUp: (() => void) | undefined = undefined
476
+
477
+ constructor(private componentCommandReceiver: RNComponentCommandReceiver, private tag: Tag) {
478
+ }
479
+
480
+ subscribe<TCommandName extends keyof CommandArgvByName>(commandName: TCommandName, listener: (argv: CommandArgvByName[TCommandName]) => void) {
481
+ if (!this.listenersByCommandName.has(commandName)) {
482
+ this.listenersByCommandName.set(commandName, new Set())
483
+ }
484
+ this.listenersByCommandName.get(commandName)!.add(listener)
485
+ const hasRegisteredCommandReceiver = !!this.cleanUp
486
+ if (!hasRegisteredCommandReceiver) {
487
+ this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName: string, argv: any[]) => {
488
+ if (this.listenersByCommandName.has(commandName)) {
489
+ const listeners = this.listenersByCommandName.get(commandName)!
490
+ listeners.forEach(listener => {
491
+ listener(argv)
492
+ })
493
+ }
494
+ })
495
+ }
496
+
497
+ return () => {
498
+ this.listenersByCommandName.get(commandName)?.delete(listener)
499
+ if (this.listenersByCommandName.get(commandName)?.size ?? 0 === 0) {
500
+ this.listenersByCommandName.delete(commandName)
501
+ }
502
+ if (this.listenersByCommandName.size === 0) {
503
+ this.cleanUp?.()
504
+ }
505
+ }
506
+ }
507
+ }
508
+
509
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./RNCWebView"
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./ts"
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * as RNC from "./components/ts"
6
+ export * as TM from "./turboModules/ts"
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ import { Tag } from "@rnoh/react-native-openharmony/ts"
6
+
7
+ export namespace RNCWebView {
8
+ export const NAME = 'RNCWebView' as const
9
+
10
+ export interface Spec {
11
+ getConstants(): {};
12
+
13
+ isFileUploadSupported(): Promise<boolean>;
14
+
15
+ shouldStartLoadWithLockIdentifier(shouldStart: boolean, lockIdentifier: number): void;
16
+
17
+ }
18
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ import { Tag } from "@rnoh/react-native-openharmony/ts"
6
+
7
+ export namespace RNCWebViewModule {
8
+ export const NAME = 'RNCWebViewModule' as const
9
+
10
+ export interface Spec {
11
+ isFileUploadSupported(): Promise<boolean>;
12
+
13
+ shouldStartLoadWithLockIdentifier(shouldStart: boolean, lockIdentifier: number): void;
14
+
15
+ }
16
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./RNCWebView"
6
+ export * from "./RNCWebViewModule"
@@ -0,0 +1,11 @@
1
+ {
2
+ "module":{
3
+ "name":"rn_webview",
4
+ "type":"har",
5
+ "deviceTypes": [
6
+ "default",
7
+ "tablet",
8
+ "2in1"
9
+ ]
10
+ }
11
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "string":[
3
+ {
4
+ "name":"page_show",
5
+ "value":"page from npm package"
6
+ },
7
+ {
8
+ "name":"deny",
9
+ "value":"不允许"
10
+ },
11
+ {
12
+ "name":"on_confirm",
13
+ "value":"允许"
14
+ },
15
+ {
16
+ "name": "use_your_camera",
17
+ "value": "使用你的摄像头?"
18
+ },
19
+ {
20
+ "name": "use_your_microphone",
21
+ "value": "使用你的麦克风?"
22
+ },
23
+ {
24
+ "name": "use_your_camera_and_microphone",
25
+ "value": "使用你的摄像头和麦克风?"
26
+ },
27
+ {
28
+ "name": "midi_sysex_resources",
29
+ "value": "访问 MIDI SYSEX 资源?"
30
+ },
31
+ {
32
+ "name": "determined",
33
+ "value": "确定"
34
+ },
35
+ {
36
+ "name": "cancel",
37
+ "value": "取消"
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "string":[
3
+ {
4
+ "name":"page_show",
5
+ "value":"page from npm package"
6
+ },
7
+ {
8
+ "name":"deny",
9
+ "value":"deny"
10
+ },
11
+ {
12
+ "name":"on_confirm",
13
+ "value":"on confirm"
14
+ },
15
+ {
16
+ "name": "use_your_camera",
17
+ "value": "use Your Camera?"
18
+ },
19
+ {
20
+ "name": "use_your_microphone",
21
+ "value": "use your microphone?"
22
+ },
23
+ {
24
+ "name": "use_your_camera_and_microphone",
25
+ "value": "use your camera and microphone?"
26
+ },
27
+ {
28
+ "name": "midi_sysex_resources",
29
+ "value": "MIDI SYSEX Resources?"
30
+ },
31
+ {
32
+ "name": "determined",
33
+ "value": "determined"
34
+ },
35
+ {
36
+ "name": "cancel",
37
+ "value": "cancel"
38
+ }
39
+ ]
40
+ }