• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16declare type WebviewController = import('../api/@ohos.web.webview').default.WebviewController;
17
18/**
19 * Enum type supplied to {@link getMessageLevel} for receiving the console log level of JavaScript.
20 * @since 8
21 */
22declare enum MessageLevel {
23  /**
24   * Debug level.
25   * @since 8
26   */
27  Debug,
28
29  /**
30   * Error level.
31   * @since 8
32   */
33  Error,
34
35  /**
36   * Info level.
37   * @since 8
38   */
39  Info,
40
41  /**
42   * Log level.
43   * @since 8
44   */
45  Log,
46
47  /**
48   * Warn level.
49   * @since 8
50   */
51  Warn,
52}
53
54/**
55 * The Web's behavior to load from HTTP or HTTPS. Defaults to MixedMode.None.
56 * @since 8
57 */
58declare enum MixedMode {
59  /**
60   * Allows all sources.
61   * @since 8
62   */
63  All,
64
65  /**
66   * Allows sources Compatibly.
67   * @since 8
68   */
69  Compatible,
70
71  /**
72   * Don't allow unsecure sources from a secure origin.
73   * @since 8
74   */
75  None,
76}
77
78/**
79 * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest.
80 * @since 8
81 */
82declare enum HitTestType {
83  /**
84   * The edit text.
85   * @since 8
86   */
87  EditText,
88
89  /**
90   * The email address.
91   * @since 8
92   */
93  Email,
94
95  /**
96   * The HTML::a tag with src=http.
97   * @since 8
98   */
99  HttpAnchor,
100
101  /**
102   * The HTML::a tag with src=http + HTML::img.
103   * @since 8
104   */
105  HttpAnchorImg,
106
107  /**
108   * The HTML::img tag.
109   * @since 8
110   */
111  Img,
112
113  /**
114   * The map address.
115   * @since 8
116   */
117  Map,
118
119  /**
120   * The phone number.
121   * @since 8
122   */
123  Phone,
124
125  /**
126   * Other unknown HitTest.
127   * @since 8
128   */
129  Unknown,
130}
131
132/**
133 * Enum type supplied to {@link cacheMode} for setting the Web cache mode.
134 * @since 8
135 */
136declare enum CacheMode {
137  /**
138   * load cache when they are available and not expired, otherwise load online.
139   * @since 9
140   */
141  Default,
142
143  /**
144   * load cache when they are available, otherwise load online.
145   * @since 8
146   */
147  None,
148
149  /**
150   * Load cache first, then online.
151   * @since 8
152   */
153  Online,
154
155  /**
156   * load cache and not online.
157   * @since 8
158   */
159  Only,
160}
161
162/**
163 * Enum type supplied to {@link darkMode} for setting the web dark mode.
164 * @since 9
165 */
166declare enum WebDarkMode {
167  /**
168   * Disable the web dark mode.
169   * @since 9
170   */
171  Off,
172
173  /**
174   * Enable the web dark mode.
175   * @since 9
176   */
177  On,
178
179  /**
180   * Make web dark mode follow the system.
181   * @since 9
182   */
183  Auto,
184}
185
186/**
187 * Define the handler to exit the full screen mode, related to the {@link onFullScreenEnter} event.
188 * @since 9
189 */
190declare class FullScreenExitHandler {
191  /**
192   * Constructor.
193   * @since 9
194   */
195  constructor();
196
197  /**
198   * Exit the full screen mode.
199   * @since 9
200   */
201  exitFullScreen(): void;
202}
203
204/**
205 * Enum type supplied to {@link renderExitReason} when onRenderExited being called.
206 * @since 9
207 */
208declare enum RenderExitReason {
209  /**
210   * Render process non-zero exit status.
211   * @since 9
212   */
213  ProcessAbnormalTermination,
214
215  /**
216   * SIGKILL or task manager kill.
217   * @since 9
218   */
219  ProcessWasKilled,
220
221  /**
222   * Segmentation fault.
223   * @since 9
224   */
225  ProcessCrashed,
226
227  /**
228   * Out of memory.
229   * @since 9
230   */
231  ProcessOom,
232
233  /**
234   * Unknown reason.
235   * @since 9
236   */
237  ProcessExitUnknown,
238}
239
240/**
241 * Enum type supplied to {@link error} when onSslErrorEventReceive being called.
242 * @since 9
243 */
244 declare enum SslError {
245  /**
246   * General error.
247   * @since 9
248   */
249   Invalid,
250
251  /**
252   * Hostname mismatch.
253   * @since 9
254   */
255   HostMismatch,
256
257  /**
258   * The certificate date is invalid.
259   * @since 9
260   */
261   DateInvalid,
262
263  /**
264   * The certificate authority is not trusted.
265   * @since 9
266   */
267   Untrusted,
268}
269
270/**
271 * Enum type supplied to {@link FileSelectorParam} when onFileSelectorShow being called.
272 * @since 9
273 */
274declare enum FileSelectorMode {
275  /**
276   * Allows single file to be selected.
277   * @since 9
278   */
279  FileOpenMode,
280
281  /**
282   * Allows multiple files to be selected.
283   * @since 9
284   */
285  FileOpenMultipleMode,
286
287  /**
288   * Allows file folders to be selected.
289   * @since 9
290   */
291  FileOpenFolderMode,
292
293  /**
294   * Allows select files to save.
295   * @since 9
296   */
297  FileSaveMode,
298}
299
300/**
301 * Encompassed message information as parameters to {@link onFileSelectorShow} method.
302 * @since 9
303 */
304declare class FileSelectorParam {
305  /**
306   * Constructor.
307   * @since 9
308   */
309  constructor();
310
311  /**
312    * Gets the title of this file selector.
313    * @returns Return the title of this file selector.
314    *
315    * @since 9
316    */
317  getTitle(): string;
318
319  /**
320    * Gets the FileSelectorMode of this file selector.
321    * @returns Return the FileSelectorMode of this file selector.
322    *
323    * @since 9
324    */
325  getMode(): FileSelectorMode;
326
327  /**
328    * Gets an array of acceptable MMIE type.
329    * @returns Return an array of acceptable MMIE type.
330    *
331    * @since 9
332    */
333  getAcceptType(): Array<string>;
334
335  /**
336   * Gets whether this file selector use a live media captured value.
337   * @returns Return {@code true} if captured media; return {@code false} otherwise.
338   * @since 9
339   */
340  isCapture(): boolean;
341}
342
343/**
344 * Defines the js result.
345 * @since 8
346 */
347declare class JsResult {
348  /**
349   * Constructor.
350   * @since 8
351   */
352  constructor();
353
354  /**
355   * Handle the user's JavaScript result if cancel the dialog.
356   * @since 8
357   */
358  handleCancel(): void;
359
360  /**
361   * Handle the user's JavaScript result if confirm the dialog.
362   * @since 8
363   */
364  handleConfirm(): void;
365
366  /**
367   * Handle the user's JavaScript result if confirm the prompt dialog.
368   * @since 9
369   */
370  handlePromptConfirm(result: string): void;
371}
372
373/**
374 * Defines the file selector result, related to {@link onFileSelectorShow} method.
375 * @since 9
376 */
377declare class FileSelectorResult {
378  /**
379   * Constructor.
380   * @since 9
381   */
382  constructor();
383
384   /**
385    * select a list of files.
386    * @since 9
387    */
388  handleFileList(fileList: Array<string>): void;
389}
390
391/**
392 * Defines the http auth request result, related to {@link onHttpAuthRequest} method.
393 * @since 9
394 */
395declare class HttpAuthHandler {
396  /**
397   * Constructor.
398   * @since 9
399   */
400  constructor();
401
402  /**
403   * confirm.
404   * @since 9
405   */
406  confirm(userName: string, password: string): boolean;
407
408  /**
409   * cancel.
410   * @since 9
411   */
412  cancel(): void;
413
414  /**
415   * isHttpAuthInfoSaved.
416   * @since 9
417   */
418  isHttpAuthInfoSaved(): boolean;
419}
420
421/**
422 * Defines the ssl error request result, related to {@link onSslErrorEventReceive} method.
423 * @since 9
424 */
425 declare class SslErrorHandler {
426  /**
427   * Constructor.
428   * @since 9
429   */
430  constructor();
431
432  /**
433   * Confirm to use the SSL certificate.
434   * @since 9
435   */
436  handleConfirm(): void;
437
438  /**
439   * Cancel this request.
440   * @since 9
441   */
442  handleCancel(): void;
443}
444
445/**
446 * Defines the client certificate request result, related to {@link onClientAuthenticationRequest} method.
447 * @since 9
448 */
449 declare class ClientAuthenticationHandler {
450  /**
451   * Constructor.
452   * @since 9
453   */
454  constructor();
455
456  /**
457   * Confirm to use the specified private key and client certificate chain.
458   * @param priKeyFile The file that store private key.
459   * @param certChainFile The file that store client certificate chain.
460   *
461   * @since 9
462   */
463  confirm(priKeyFile : string, certChainFile : string): void;
464
465  /**
466   * Cancel this certificate request.
467   * @since 9
468   */
469  cancel(): void;
470
471  /**
472   * Ignore this certificate request temporarily.
473   * @since 9
474   */
475  ignore(): void;
476}
477
478/**
479 * Defines the accessible resource type, related to {@link onPermissionRequest} method.
480 * @since 9
481 */
482declare enum ProtectedResourceType {
483  /**
484   * The MidiSysex resource.
485   * @since 9
486   */
487  MidiSysex = "TYPE_MIDI_SYSEX"
488}
489
490/**
491 * Defines the onPermissionRequest callback, related to {@link onPermissionRequest} method.
492 * @since 9
493 */
494declare class PermissionRequest {
495  /**
496   * Constructor.
497   * @since 9
498   */
499  constructor();
500
501  /**
502   * Reject the request.
503   * @since 9
504   */
505  deny(): void;
506
507  /**
508   * Gets the source if the webpage that attempted to access the restricted resource.
509   * @since 9
510   */
511  getOrigin(): string;
512
513  /**
514   * Gets the resource that the webpage is trying to access.
515   * @since 9
516   */
517  getAccessibleResource(): Array<string>;
518
519  /**
520   * Grant origin access to a given resource.
521   * @since 9
522   */
523  grant(resources: Array<string>): void;
524}
525
526/**
527 * Defines the onDataResubmission callback, related to {@link onDataResubmission} method.
528 * @since 9
529 */
530declare class DataResubmissionHandler {
531  /**
532   * Constructor.
533   * @since 9
534   */
535  constructor();
536
537  /**
538   * Resend related form data.
539   * @since 9
540   */
541  resend(): void;
542
543  /**
544   * Do not resend related form data.
545   * @since 9
546   */
547  cancel(): void;
548}
549
550/**
551 * Defines the onWindowNew callback, related to {@link onWindowNew} method.
552 * @since 9
553 */
554declare class ControllerHandler {
555  /**
556   * Constructor.
557   * @since 9
558   */
559   constructor();
560
561  /**
562   * Set WebController object.
563   * @since 9
564   */
565  setWebController(controller: WebviewController): void;
566}
567
568/**
569* Defines the context menu source type, related to {@link onContextMenuShow} method.
570* @since 9
571*/
572declare enum ContextMenuSourceType {
573  /**
574   * Other source types.
575   * @since 9
576   */
577  None,
578
579  /**
580   * Mouse.
581   * @since 9
582   */
583  Mouse,
584
585  /**
586   * Long press.
587   * @since 9
588   */
589  LongPress,
590}
591
592/**
593* Defines the context menu media type, related to {@link onContextMenuShow} method.
594* @since 9
595*/
596declare enum ContextMenuMediaType {
597  /**
598   * Not a special node or other media types.
599   * @since 9
600   */
601  None,
602
603  /**
604   * Image.
605   * @since 9
606   */
607  Image,
608}
609
610/**
611* Defines the context menu input field type, related to {@link onContextMenuShow} method.
612* @since 9
613*/
614declare enum ContextMenuInputFieldType {
615  /**
616   * Not an input field.
617   * @since 9
618   */
619  None,
620
621  /**
622   * The plain text type.
623   * @since 9
624   */
625  PlainText,
626
627  /**
628   * The password type.
629   * @since 9
630   */
631  Password,
632
633  /**
634   * The number type.
635   * @since 9
636   */
637  Number,
638
639  /**
640   * The telephone type.
641   * @since 9
642   */
643  Telephone,
644
645  /**
646   * Other types.
647   * @since 9
648   */
649  Other,
650}
651
652/**
653 * Defines the context menu supported event bit flags, related to {@link onContextMenuShow} method.
654 * @since 9
655 */
656declare enum ContextMenuEditStateFlags {
657  NONE = 0,
658  CAN_CUT = 1 << 0,
659  CAN_COPY = 1 << 1,
660  CAN_PASTE = 1 << 2,
661  CAN_SELECT_ALL = 1 << 3,
662}
663
664/**
665* Defines the context menu param, related to {@link WebContextMenuParam} method.
666* @since 9
667*/
668declare class WebContextMenuParam {
669  /**
670   * Constructor.
671   * @since 9
672   */
673  constructor();
674
675  /**
676   * Horizontal offset coordinates of the menu within the Web component.
677   * @returns The context menu x coordinate.
678   *
679   * @since 9
680   */
681  x(): number;
682
683  /**
684   * Vertical offset coordinates for the menu within the Web component.
685   * @returns The context menu y coordinate.
686   *
687   * @since 9
688   */
689  y(): number;
690
691  /**
692   * If the long-press location is the link returns the link's security-checked URL.
693   * @returns If relate to a link return link url, else return null.
694   *
695   * @since 9
696   */
697  getLinkUrl(): string;
698
699  /**
700   * If the long-press location is the link returns the link's original URL.
701   * @returns If relate to a link return unfiltered link url, else return null.
702   *
703   * @since 9
704   */
705  getUnfilteredLinkUrl(): string;
706
707  /**
708   * Returns the SRC URL if the selected element has a SRC attribute.
709   * @returns If this context menu is "src" attribute, return link url, else return null.
710   *
711   * @since 9
712   */
713  getSourceUrl(): string;
714
715  /**
716   * Long press menu location has image content.
717   * @returns Return whether this context menu has image content.
718   *
719   * @since 9
720   */
721  existsImageContents(): boolean;
722
723  /**
724   * Returns the type of context node.
725   *
726   * @since 9
727   */
728  getMediaType(): ContextMenuMediaType;
729
730  /**
731   * Returns the text of the selection.
732   *
733   * @since 9
734   */
735  getSelectionText(): string;
736
737  /**
738   * Returns the context menu source type.
739   *
740   * @since 9
741   */
742  getSourceType(): ContextMenuSourceType;
743
744  /**
745   * Returns input field type if the context menu was invoked on an input field.
746   *
747   * @since 9
748   */
749  getInputFieldType(): ContextMenuInputFieldType;
750
751  /**
752   * Returns whether the context is editable.
753   * @since 9
754   */
755  isEditable(): boolean;
756
757  /**
758   * Returns the context editable flags {@link ContextMenuEditStateFlags}.
759   * @since 9
760   */
761  getEditStateFlags(): number;
762}
763
764/**
765 * Defines the context menu result, related to {@link WebContextMenuResult} method.
766 * @since 9
767 */
768declare class WebContextMenuResult {
769  /**
770   * Constructor.
771   * @since 9
772   */
773  constructor();
774
775  /**
776   * When close context menu without other call in WebContextMenuResult,
777   * User should call this function to close menu
778   *
779   * @since 9
780   */
781  closeContextMenu(): void;
782
783  /**
784   * If WebContextMenuParam has image content, this function will copy image related to this context menu.
785   * If WebContextMenuParam has no image content, this function will do nothing.
786   *
787   * @since 9
788   */
789  copyImage(): void;
790
791  /**
792   * Executes the copy operation related to this context menu.
793   *
794   * @since 9
795   */
796  copy(): void;
797
798  /**
799   * Executes the paste operation related to this context menu.
800   *
801   * @since 9
802   */
803  paste(): void;
804
805  /**
806   * Executes the cut operation related to this context menu.
807   *
808   * @since 9
809   */
810  cut(): void;
811
812  /**
813   * Executes the selectAll operation related to this context menu.
814   *
815   * @since 9
816   */
817  selectAll(): void;
818}
819
820/**
821 * Encompassed message information as parameters to {@link onConsole} method.
822 * @since 8
823 */
824declare class ConsoleMessage {
825  /**
826   * Constructor.
827   * @param message The console message.
828   * @param sourceId The Web source file's path and name.
829   * @param lineNumber The line number of the console message.
830   * @param messageLevel The console log level.
831   *
832   * @since 8
833   * @deprecated since 9
834   * @useinstead ohos.web.ConsoleMessage#constructor
835   */
836  constructor(message: string, sourceId: string, lineNumber: number, messageLevel: MessageLevel);
837
838  /**
839   * Constructor.
840   * @since 9
841   */
842  constructor();
843
844  /**
845   * Gets the message of a console message.
846   * @returns Return the message of a console message.
847   *
848   * @since 8
849   */
850  getMessage(): string;
851
852  /**
853   * Gets the Web source file's path and name of a console message.
854   * @returns Return the Web source file's path and name of a console message.
855   *
856   * @since 8
857   */
858  getSourceId(): string;
859
860  /**
861   * Gets the line number of a console message.
862   * @returns Return the line number of a console message.
863   *
864   * @since 8
865   */
866  getLineNumber(): number;
867
868  /**
869   * Gets the message level of a console message.
870   * @returns Return the message level of a console message, which can be {@link MessageLevel}.
871   *
872   * @since 8
873   */
874  getMessageLevel(): MessageLevel;
875}
876
877/**
878 * Encompassed message information as parameters to {@link onConsole} method.
879 * @since 8
880 */
881
882/**
883 * Defines the Web resource request.
884 * @since 8
885 */
886declare class WebResourceRequest {
887  /**
888   * Constructor.
889   * @since 8
890   */
891  constructor();
892
893  /**
894   * Gets request headers.
895   * @returns Return the request headers
896   *
897   * @since 8
898   */
899  getRequestHeader(): Array<Header>;
900
901  /**
902   * Gets the request URL.
903   * @returns Return the request URL.
904   *
905   * @since 8
906   */
907  getRequestUrl(): string;
908
909  /**
910   * Check whether the request is associated with gesture.
911   * @returns Return {@code true} if the request is associated with gesture;return {@code false} otherwise.
912   *
913   * @since 8
914   */
915  isRequestGesture(): boolean;
916
917  /**
918   * Check whether the request is for getting the main frame.
919   * @returns Return {@code true} if the request is associated with gesture for getting the main frame; return {@code false} otherwise.
920   *
921   * @since 8
922   */
923  isMainFrame(): boolean;
924
925  /**
926   * Check whether the request redirects.
927   * @returns Return {@code true} if the request redirects; return {@code false} otherwise.
928   *
929   * @since 8
930   */
931  isRedirect(): boolean;
932
933  /**
934   * Get request method.
935   * @returns Return the request method.
936   *
937   * @since 9
938   */
939  getRequestMethod(): string;
940}
941
942
943/**
944 * Defines the Web resource response.
945 * @since 8
946 */
947 declare class WebResourceResponse {
948  /**
949   * Constructor.
950   * @since 8
951   */
952  constructor();
953
954  /**
955   * Gets the response data.
956   * @returns Return the response data.
957   *
958   * @since 8
959   */
960  getResponseData(): string;
961
962  /**
963   * Gets the response encoding.
964   * @returns Return the response encoding.
965   *
966   * @since 8
967   */
968  getResponseEncoding(): string;
969
970  /**
971   * Gets the response MIME type.
972   * @returns Return the response MIME type.
973   *
974   * @since 8
975   */
976  getResponseMimeType(): string;
977
978  /**
979   * Gets the reason message.
980   * @returns Return the reason message.
981   *
982   * @since 8
983   */
984  getReasonMessage(): string;
985
986  /**
987   * Gets the response headers.
988   * @returns Return the response headers.
989   *
990   * @since 8
991   */
992  getResponseHeader() : Array<Header>;
993
994  /**
995   * Gets the response code.
996   * @returns Return the response code.
997   *
998   * @since 8
999   */
1000  getResponseCode(): number;
1001
1002  /**
1003   * Sets the response data.
1004   * @param data the response data.
1005   *
1006   * @since 9
1007   */
1008  setResponseData(data: string | number);
1009
1010  /**
1011   * Sets the response encoding.
1012   * @param encoding the response encoding.
1013   *
1014   * @since 9
1015   */
1016  setResponseEncoding(encoding: string);
1017
1018 /**
1019   * Sets the response MIME type.
1020   * @param mimeType the response MIME type.
1021   *
1022   * @since 9
1023   */
1024  setResponseMimeType(mimeType: string);
1025
1026  /**
1027   * Sets the reason message.
1028   * @param reason the reason message.
1029   *
1030   * @since 9
1031   */
1032  setReasonMessage(reason: string);
1033
1034  /**
1035   * Sets the response headers.
1036   * @param header the response headers.
1037   *
1038   * @since 9
1039   */
1040  setResponseHeader(header: Array<Header>);
1041
1042  /**
1043   * Sets the response code.
1044   * @param code the response code.
1045   *
1046   * @since 9
1047   */
1048  setResponseCode(code: number);
1049
1050  /**
1051   * Sets the response is ready or not.
1052   * @param IsReady whether the response is ready.
1053   *
1054   * @since 9
1055   */
1056  setResponseIsReady(IsReady: boolean);
1057}
1058
1059/**
1060 * Defines the Web's request/response header.
1061 * @since 8
1062 */
1063declare interface Header {
1064  /**
1065   * Gets the key of the request/response header.
1066   * @since 8
1067   */
1068  headerKey: string;
1069
1070  /**
1071   * Gets the value of the request/response header.
1072   * @since 8
1073   */
1074  headerValue: string;
1075}
1076
1077/**
1078 * Defines the Web resource error.
1079 * @since 8
1080 */
1081declare class WebResourceError {
1082  /**
1083   * Constructor.
1084   * @since 8
1085   */
1086  constructor();
1087
1088  /**
1089   * Gets the info of the Web resource error.
1090   * @returns Return the info of the Web resource error.
1091   *
1092   * @since 8
1093   */
1094  getErrorInfo(): string;
1095
1096  /**
1097   * Gets the code of the Web resource error.
1098   * @returns Return the code of the Web resource error.
1099   *
1100   * @since 8
1101   */
1102  getErrorCode(): number;
1103}
1104
1105/**
1106 * Defines the js geolocation request.
1107 * @since 8
1108 */
1109declare class JsGeolocation {
1110  /**
1111   * Constructor.
1112   * @since 8
1113   */
1114  constructor();
1115
1116  /**
1117   * Report the geolocation permission status from users.
1118   * @param origin The origin that ask for the geolocation permission.
1119   * @param allow The geolocation permission status.
1120   * @param retain Whether to allow the geolocation permission status to be saved to the system.
1121   *
1122   * @since 8
1123   */
1124  invoke(origin: string, allow: boolean, retain: boolean): void;
1125}
1126
1127/**
1128 * Defines the Web cookie.
1129 * @since 8
1130 */
1131declare class WebCookie {
1132  /**
1133   * Constructor.
1134   * @since 8
1135   */
1136  constructor();
1137
1138  /**
1139   * Sets the cookie.
1140   * @since 8
1141   * @deprecated since 9
1142   * @useinstead ohos.web.webview.webview.WebCookieManager#setCookie
1143   */
1144  setCookie();
1145
1146  /**
1147   * Saves the cookies.
1148   * @since 8
1149   * @deprecated since 9
1150   * @useinstead ohos.web.webview.webview.WebCookieManager#saveCookieAsync
1151   */
1152  saveCookie();
1153}
1154
1155/**
1156 * Defines the Web controller.
1157 * @since 8
1158 * @deprecated since 9
1159 * @useinstead ohos.web.webview.webview.WebviewController
1160 */
1161 declare class WebController {
1162  /**
1163   * Constructor.
1164   * @since 8
1165   * @deprecated since 9
1166   */
1167  constructor();
1168
1169  /**
1170   * Let the Web inactive.
1171   * @since 8
1172   * @deprecated since 9
1173   * @useinstead ohos.web.webview.webview.WebviewController#onInactive
1174   */
1175  onInactive(): void;
1176
1177  /**
1178   * Let the Web active.
1179   * @since 8
1180   * @deprecated since 9
1181   * @useinstead ohos.web.webview.webview.WebviewController#onActive
1182   */
1183  onActive(): void;
1184
1185  /**
1186   * Let the Web zoom by.
1187   * @param factor The zoom factor.
1188   *
1189   * @since 8
1190   * @deprecated since 9
1191   * @useinstead ohos.web.webview.webview.WebviewController#zoom
1192   */
1193  zoom(factor: number): void;
1194
1195  /**
1196   * Clears the history in the Web.
1197   * @since 8
1198   * @deprecated since 9
1199   * @useinstead ohos.web.webview.webview.WebviewController#clearHistory
1200   */
1201  clearHistory(): void;
1202
1203  /**
1204   * Loads a piece of code and execute JS code in the context of the currently displayed page.
1205   * @param options The options with a piece of code and a callback.
1206   *
1207   * @since 8
1208   * @deprecated since 9
1209   * @useinstead ohos.web.webview.webview.WebviewController#runJavaScript
1210   */
1211  runJavaScript(options: { script: string, callback?: (result: string) => void });
1212
1213  /**
1214   * Loads the data or URL.
1215   * @param options The options with the data or URL and other information.
1216   *
1217   * @since 8
1218   * @deprecated since 9
1219   * @useinstead ohos.web.webview.webview.WebviewController#loadData
1220   */
1221  loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string });
1222
1223  /**
1224   * Loads the given URL.
1225   * @param options The options with the URL and other information.
1226   *
1227   * @since 8
1228   * @deprecated since 9
1229   * @useinstead ohos.web.webview.webview.WebviewController#loadUrl
1230   */
1231  loadUrl(options: { url: string | Resource, headers?: Array<Header> });
1232
1233  /**
1234   * refreshes the current URL.
1235   * @since 8
1236   * @deprecated since 9
1237   * @useinstead ohos.web.webview.webview.WebviewController#refresh
1238   */
1239  refresh();
1240
1241  /**
1242   * Stops the current load.
1243   * @since 8
1244   * @deprecated since 9
1245   * @useinstead ohos.web.webview.webview.WebviewController#stop
1246   */
1247  stop();
1248
1249  /**
1250   * Registers the JavaScript object and method list.
1251   * @param options The option with the JavaScript object and method list.
1252   *
1253   * @since 8
1254   * @deprecated since 9
1255   * @useinstead ohos.web.webview.webview.WebviewController#registerJavaScriptProxy
1256   */
1257  registerJavaScriptProxy(options: { object: object, name: string, methodList: Array<string> });
1258
1259  /**
1260   * Deletes a registered JavaScript object with given name.
1261   * @param name The name of a registered JavaScript object to be deleted.
1262   *
1263   * @since 8
1264   * @deprecated since 9
1265   * @useinstead ohos.web.webview.webview.WebviewController#deleteJavaScriptRegister
1266   */
1267  deleteJavaScriptRegister(name: string);
1268
1269  /**
1270   * Gets the type of HitTest.
1271   * @since 8
1272   * @deprecated since 9
1273   * @useinstead ohos.web.webview.webview.WebviewController#getHitTest
1274   */
1275  getHitTest(): HitTestType;
1276
1277  /**
1278   * Gets the request focus.
1279   * @since 8
1280   * @deprecated since 9
1281   * @useinstead ohos.web.webview.webview.WebviewController#requestFocus
1282   */
1283  requestFocus();
1284
1285  /**
1286   * Checks whether the web page can go back.
1287   * @since 8
1288   * @deprecated since 9
1289   * @useinstead ohos.web.webview.webview.WebviewController#accessBackward
1290   */
1291  accessBackward(): boolean;
1292
1293  /**
1294   * Checks whether the web page can go forward.
1295   * @since 8
1296   * @deprecated since 9
1297   * @useinstead ohos.web.webview.webview.WebviewController#accessForward
1298   */
1299  accessForward(): boolean;
1300
1301  /**
1302   * Checks whether the web page can go back or forward the given number of steps.
1303   * @param step The number of steps.
1304   *
1305   * @since 8
1306   * @deprecated since 9
1307   * @useinstead ohos.web.webview.webview.WebviewController#accessStep
1308   */
1309  accessStep(step: number): boolean;
1310
1311  /**
1312   * Goes back in the history of the web page.
1313   * @since 8
1314   * @deprecated since 9
1315   * @useinstead ohos.web.webview.webview.WebviewController#backward
1316   */
1317  backward();
1318
1319  /**
1320   * Goes forward in the history of the web page.
1321   * @since 8
1322   * @deprecated since 9
1323   * @useinstead ohos.web.webview.webview.WebviewController#forward
1324   */
1325  forward();
1326
1327  /**
1328   * Gets network cookie manager
1329   * @since 9
1330   */
1331  getCookieManager() : WebCookie
1332}
1333
1334/**
1335 * Defines the Web options.
1336 * @since 8
1337 */
1338declare interface WebOptions {
1339  /**
1340   * Sets the address of the web page to be displayed.
1341   * @since 8
1342   */
1343  src: string | Resource;
1344  /**
1345   * Sets the controller of the Web.
1346   * @type { (WebController) }
1347   * @since 8
1348   */
1349    /**
1350   * Sets the controller of the Web.
1351   * @type { (WebController | WebviewController) }
1352   * @since 9
1353    */
1354  controller: WebController | WebviewController;
1355}
1356
1357/**
1358 * Defines the Web interface.
1359 * @since 8
1360 */
1361interface WebInterface {
1362  /**
1363   * Sets Value.
1364   * @since 8
1365   */
1366  (value: WebOptions): WebAttribute;
1367}
1368
1369/**
1370 * Defines the Web attribute functions.
1371 * @since 8
1372 */
1373declare class WebAttribute extends CommonMethod<WebAttribute> {
1374  /**
1375   * Sets whether the Web allows JavaScript scripts to execute.
1376   * @param javaScriptAccess {@code true} means the Web can allows JavaScript scripts to execute; {@code false} otherwise.
1377   *
1378   * @since 8
1379   */
1380  javaScriptAccess(javaScriptAccess: boolean): WebAttribute;
1381
1382  /**
1383   * Sets whether enable local file system access in Web.
1384   * @param fileAccess {@code true} means enable local file system access in Web; {@code false} otherwise.
1385   *
1386   * @since 8
1387   */
1388  fileAccess(fileAccess: boolean): WebAttribute;
1389
1390  /**
1391   * Sets whether to allow image resources to be loaded from the network.
1392   * @param onlineImageAccess {@code true} means the Web can allow image resources to be loaded from the network;
1393   * {@code false} otherwise.
1394   *
1395   * @since 8
1396   */
1397  onlineImageAccess(onlineImageAccess: boolean): WebAttribute;
1398
1399  /**
1400   * Sets whether to enable the DOM Storage API permission.
1401   * @param domStorageAccess {@code true} means enable the DOM Storage API permission in Web; {@code false} otherwise.
1402   *
1403   * @since 8
1404   */
1405  domStorageAccess(domStorageAccess: boolean): WebAttribute;
1406
1407  /**
1408   * Sets whether the Web can automatically load image resources.
1409   * @param imageAccess {@code true} means the Web can automatically load image resources; {@code false} otherwise.
1410   *
1411   * @since 8
1412   */
1413  imageAccess(imageAccess: boolean): WebAttribute;
1414
1415  /**
1416   * Sets how to load HTTP and HTTPS content.
1417   * @param mixedMode The mixed mode, which can be {@link MixedMode}.
1418   *
1419   * @since 8
1420   */
1421  mixedMode(mixedMode: MixedMode): WebAttribute;
1422
1423  /**
1424   * Sets whether the Web supports zooming using gestures.
1425   * @param zoomAccess {@code true} means the Web supports zooming using gestures; {@code false} otherwise.
1426   *
1427   * @since 8
1428   */
1429  zoomAccess(zoomAccess: boolean): WebAttribute;
1430
1431  /**
1432   * Sets whether to allow access to geographical locations.
1433   * @param geolocationAccess {@code true} means the Web allows access to geographical locations; {@code false} otherwise.
1434   *
1435   * @since 8
1436   */
1437  geolocationAccess(geolocationAccess: boolean): WebAttribute;
1438
1439  /**
1440   * Injects the JavaScript object into window and invoke the function in window.
1441   * @param javaScriptProxy The JavaScript object to be injected.
1442   *
1443   * @type {controller : WebController}
1444   * @since 8
1445   */
1446    /**
1447   * Injects the JavaScript object into window and invoke the function in window.
1448   * @param javaScriptProxy The JavaScript object to be injected.
1449   *
1450   * @type {controller : WebController | WebviewController}
1451   * @since 9
1452   */
1453  javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Array<string>,
1454    controller: WebController | WebviewController }): WebAttribute;
1455
1456  /**
1457   * Sets whether the Web should save the password.
1458   * @param password {@code true} means the Web can save the password; {@code false} otherwise.
1459   *
1460   * @since 8
1461   */
1462  password(password: boolean): WebAttribute;
1463
1464  /**
1465   * Sets the mode of cache in Web.
1466   * @param cacheMode The cache mode, which can be {@link CacheMode}.
1467   *
1468   * @since 8
1469   */
1470  cacheMode(cacheMode: CacheMode): WebAttribute;
1471
1472  /**
1473   * Sets the dark mode of Web.
1474   * @param mode The dark mode, which can be {@link WebDarkMode}.
1475   *
1476   * @since 9
1477   */
1478  darkMode(mode: WebDarkMode): WebAttribute;
1479
1480  /**
1481   * Sets whether to enable forced dark algorithm when the web is in dark mode
1482   * @param access {@code true} means enable the force dark algorithm; {@code false} otherwise.
1483   *
1484   * @since 9
1485   */
1486  forceDarkAccess(access: boolean): WebAttribute;
1487
1488  /**
1489   * Sets whether the Web should save the table data.
1490   * @param tableData {@code true} means the Web can save the table data; {@code false} otherwise.
1491   *
1492   * @since 8
1493   */
1494  tableData(tableData: boolean): WebAttribute;
1495
1496  /**
1497   * Sets whether the Web access meta 'viewport' in HTML.
1498   * @param wideViewModeAccess {@code true} means the Web access meta 'viewport' in HTML; {@code false} otherwise.
1499   *
1500   * @since 8
1501   */
1502  wideViewModeAccess(wideViewModeAccess: boolean): WebAttribute;
1503
1504  /**
1505   * Sets whether the Web access overview mode.
1506   * @param overviewModeAccess {@code true} means the Web access overview mode; {@code false} otherwise.
1507   *
1508   * @since 8
1509   */
1510  overviewModeAccess(overviewModeAccess: boolean): WebAttribute;
1511
1512  /**
1513   * Sets the ratio of the text zoom.
1514   * @param textZoomAtio The ratio of the text zoom.
1515   *
1516   * @since 8
1517   * @deprecated since 9
1518   * @useinstead ohos.web.WebAttribute#textZoomRatio
1519   */
1520  textZoomAtio(textZoomAtio: number): WebAttribute;
1521
1522  /**
1523   * Sets the ratio of the text zoom.
1524   * @param textZoomRatio The ratio of the text zoom.
1525   *
1526   * @since 9
1527   */
1528   textZoomRatio(textZoomRatio: number): WebAttribute;
1529
1530  /**
1531   * Sets whether the Web access the database.
1532   * @param databaseAccess {@code true} means the Web access the database; {@code false} otherwise.
1533   *
1534   * @since 8
1535   */
1536  databaseAccess(databaseAccess: boolean): WebAttribute;
1537
1538  /**
1539   * Sets the initial scale for the Web.
1540   * @param percent the initial scale for the Web.
1541   *
1542   * @since 9
1543   */
1544  initialScale(percent: number): WebAttribute;
1545
1546  /**
1547   * Sets the Web's user agent.
1548   * @param userAgent The Web's user agent.
1549   *
1550   * @since 8
1551   */
1552  userAgent(userAgent: string): WebAttribute;
1553
1554  /**
1555   * Triggered at the end of web page loading.
1556   * @param callback The triggered function at the end of web page loading.
1557   *
1558   * @since 8
1559   */
1560  onPageEnd(callback: (event?: { url: string }) => void): WebAttribute;
1561
1562  /**
1563   * Triggered at the begin of web page loading.
1564   * @param callback The triggered function at the begin of web page loading.
1565   *
1566   * @since 8
1567   */
1568  onPageBegin(callback: (event?: { url: string }) => void): WebAttribute;
1569
1570  /**
1571   * Triggered when the page loading progress changes.
1572   * @param callback The triggered function when the page loading progress changes.
1573   *
1574   * @since 8
1575   */
1576  onProgressChange(callback: (event?: { newProgress: number }) => void): WebAttribute;
1577
1578  /**
1579   * Triggered when the title of the main application document changes.
1580   * @param callback The triggered function when the title of the main application document changes.
1581   *
1582   * @since 8
1583   */
1584  onTitleReceive(callback: (event?: { title: string }) => void): WebAttribute;
1585
1586  /**
1587   * Triggered when requesting to hide the geolocation.
1588   * @param callback The triggered function when requesting to hide the geolocation permission.
1589   *
1590   * @since 8
1591   */
1592  onGeolocationHide(callback: () => void): WebAttribute;
1593
1594  /**
1595   * Triggered when requesting to show the geolocation permission.
1596   * @param callback The triggered function when requesting to show the geolocation permission.
1597   *
1598   * @since 8
1599   */
1600  onGeolocationShow(callback: (event?: { origin: string, geolocation: JsGeolocation }) => void): WebAttribute;
1601
1602  /**
1603   * Triggered when the Web gets the focus.
1604   * @param callback The triggered function when the Web gets the focus.
1605   *
1606   * @since 8
1607   */
1608  onRequestSelected(callback: () => void): WebAttribute;
1609
1610  /**
1611   * Triggered when the Web wants to display a JavaScript alert() dialog.
1612   * @param callback The triggered function when the web page wants to display a JavaScript alert() dialog.
1613   *
1614   * @since 8
1615   */
1616  onAlert(callback: (event?: { url: string, message: string, result: JsResult }) => boolean): WebAttribute;
1617
1618  /**
1619   * Triggered when the Web wants to confirm navigation from JavaScript onbeforeunload.
1620   * @param callback The triggered function when the web page wants to confirm navigation from JavaScript onbeforeunload.
1621   *
1622   * @since 8
1623   */
1624  onBeforeUnload(callback: (event?: { url: string, message: string, result: JsResult }) => boolean): WebAttribute;
1625
1626  /**
1627   * Triggered when the web page wants to display a JavaScript confirm() dialog.
1628   * @param callback The Triggered function when the web page wants to display a JavaScript confirm() dialog.
1629   *
1630   * @since 8
1631   */
1632  onConfirm(callback: (event?: { url: string, message: string, result: JsResult }) => boolean): WebAttribute;
1633
1634  /**
1635   * Triggered when the web page wants to display a JavaScript prompt() dialog.
1636   * @param callback The Triggered function when the web page wants to display a JavaScript prompt() dialog.
1637   *
1638   * @since 9
1639   */
1640  onPrompt(callback: (event?: {url: string, message: string, value: string, result: JsResult }) => boolean): WebAttribute;
1641
1642  /**
1643   * Triggered when the web page receives a JavaScript console message.
1644   * @param callback The triggered function when the web page receives a JavaScript console message.
1645   *
1646   * @since 8
1647   */
1648  onConsole(callback: (event?: { message: ConsoleMessage }) => boolean): WebAttribute;
1649
1650  /**
1651   * Triggered when the web page receives a web resource loading error.
1652   * @param callback The triggered function when the web page receives a web resource loading error.
1653   *
1654   * @since 8
1655   */
1656  onErrorReceive(callback: (event?: { request: WebResourceRequest, error: WebResourceError }) => void): WebAttribute;
1657
1658  /**
1659   * Triggered when the web page receives a web resource loading HTTP error.
1660   * @param callback The triggered function when the web page receives a web resource loading HTTP error.
1661   *
1662   * @since 8
1663   */
1664  onHttpErrorReceive(callback: (event?: { request: WebResourceRequest,
1665    response: WebResourceResponse }) => void): WebAttribute;
1666
1667  /**
1668   * Triggered when starting to download.
1669   * @param callback The triggered function when starting to download.
1670   *
1671   * @since 8
1672   */
1673  onDownloadStart(callback: (event?: { url: string, userAgent: string, contentDisposition: string, mimetype: string,
1674    contentLength: number }) => void): WebAttribute;
1675
1676  /**
1677   * Triggered when the Web page refreshes accessed history.
1678   * @param callback The triggered callback when the Web page refreshes accessed history.
1679   *
1680   * @since 8
1681   */
1682  onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean }) => void): WebAttribute;
1683
1684  /**
1685   * Triggered when the URL loading is intercepted.
1686   * @param callback The triggered callback when the URL loading is intercepted.
1687   *
1688   * @since 8
1689   */
1690  onUrlLoadIntercept(callback: (event?: { data: string | WebResourceRequest }) => boolean): WebAttribute;
1691
1692  /**
1693   * Triggered when the Web page receives an ssl Error.
1694   * @param callback The triggered callback when the Web page receives an ssl Error.
1695   *
1696   * @since 8
1697   * @deprecated since 9
1698   * @useinstead ohos.web.WebAttribute#onSslErrorEventReceive
1699   */
1700  onSslErrorReceive(callback: (event?: { handler: Function, error: object }) => void): WebAttribute;
1701
1702  /**
1703   * Triggered when the render process exits.
1704   * @param callback The triggered when the render process exits.
1705   *
1706   * @since 9
1707   */
1708  onRenderExited(callback: (event?: { renderExitReason: RenderExitReason }) => void): WebAttribute;
1709
1710  /**
1711   * Triggered when the file selector shows.
1712   * @param callback The triggered when the file selector shows.
1713   *
1714   * @since 9
1715   */
1716  onShowFileSelector(callback: (event?: { result: FileSelectorResult,
1717    fileSelector: FileSelectorParam }) => boolean): WebAttribute;
1718
1719  /**
1720   * Triggered when the render process exits.
1721   * @param callback The triggered when the render process exits.
1722   *
1723   * @since 8
1724   * @deprecated since 9
1725   * @useinstead ohos.web.WebAttribute#onRenderExited
1726   */
1727  onRenderExited(callback: (event?: { detail: object }) => boolean): WebAttribute;
1728
1729  /**
1730   * Triggered when the file selector shows.
1731   * @param callback The triggered when the file selector shows.
1732   *
1733   * @since 8
1734   * @deprecated since 9
1735   * @useinstead ohos.web.WebAttribute#onShowFileSelector
1736   */
1737  onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute;
1738
1739  /**
1740   * Triggered when the url loading.
1741   * @param callback The triggered when the url loading.
1742   *
1743   * @since 9
1744   */
1745  onResourceLoad(callback: (event: {url: string}) => void): WebAttribute;
1746
1747  /**
1748   * Triggered when the web component exit the full screen mode.
1749   * @param callback The triggered function when the web component exit the full screen mode.
1750   *
1751   * @since 9
1752   */
1753  onFullScreenExit(callback: () => void): WebAttribute;
1754
1755  /**
1756   * Triggered when the web component enter the full screen mode.
1757   * @param callback The triggered function when the web component enter the full screen mode.
1758   *
1759   * @since 9
1760   */
1761  onFullScreenEnter(callback: (event: { handler: FullScreenExitHandler}) => void): WebAttribute;
1762
1763  /**
1764   * Triggered when the scale of WebView changed.
1765   * @param callback The triggered when the scale of WebView changed.
1766   *
1767   * @since 9
1768   */
1769  onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void): WebAttribute;
1770
1771  /**
1772   * Triggered when the browser needs credentials from the user.
1773   * @param callback The triggered when the browser needs credentials from the user.
1774   *
1775   * @since 9
1776   */
1777   onHttpAuthRequest(callback: (event?: { handler: HttpAuthHandler, host: string, realm: string }) => boolean): WebAttribute;
1778
1779  /**
1780   * Triggered when the resources loading is intercepted.
1781   * @param callback The triggered callback when the resources loading is intercepted.
1782   *
1783   * @returns If the response value is null, the Web will continue to load the resources. Otherwise, the response value will be used
1784   * @since 9
1785   */
1786  onInterceptRequest(callback: (event?: { request: WebResourceRequest}) => WebResourceResponse): WebAttribute;
1787
1788  /**
1789   * Triggered when the host application that web content from the specified origin is attempting to access the resources.
1790   * @param callback The triggered callback when the host application that web content from the specified origin is
1791   *     attempting to access the resources.
1792   *
1793   * @since 9
1794   */
1795  onPermissionRequest(callback: (event?: { request: PermissionRequest }) => void): WebAttribute;
1796
1797  /**
1798   * Triggered when called to allow custom display of the context menu.
1799   * @param callback The triggered callback when called to allow custom display of the context menu.
1800   *
1801   * @returns If custom display return true.Otherwise, default display return false.
1802   * @since 9
1803   */
1804  onContextMenuShow(callback: (event?: { param: WebContextMenuParam, result: WebContextMenuResult }) => boolean): WebAttribute;
1805
1806  /**
1807   * Set whether media playback needs to be triggered by user gestures.
1808   * @param access True if it needs to be triggered manually by the user else false.
1809   *
1810   * @since 9
1811   */
1812  mediaPlayGestureAccess(access: boolean): WebAttribute;
1813
1814  /**
1815   * Notify search result to host application through onSearchResultReceive.
1816   * @param callback Function Triggered when the host application call searchAllAsync
1817   * or searchNext api on WebController and the request is valid.
1818   *
1819   * @since 9
1820   */
1821   onSearchResultReceive(callback: (event?: {activeMatchOrdinal: number, numberOfMatches: number, isDoneCounting: boolean}) => void): WebAttribute
1822
1823  /**
1824   * Triggered when the scroll bar slides to the specified position.
1825   * @param callback Function Triggered when the scroll bar slides to the specified position.
1826   *
1827   * @since 9
1828   */
1829   onScroll(callback: (event: {xOffset: number, yOffset: number}) => void): WebAttribute;
1830
1831  /**
1832   * Triggered when the Web page receives an ssl Error.
1833   * @param callback The triggered callback when the Web page receives an ssl Error.
1834   *
1835   * @since 9
1836   */
1837   onSslErrorEventReceive(callback: (event: { handler: SslErrorHandler, error: SslError }) => void): WebAttribute;
1838
1839  /**
1840   * Triggered when the Web page needs ssl client certificate from the user.
1841   * @param callback The triggered callback when needs ssl client certificate from the user.
1842   *
1843   * @since 9
1844   */
1845  onClientAuthenticationRequest(callback: (event: {handler : ClientAuthenticationHandler, host : string, port : number,
1846      keyTypes : Array<string>, issuers : Array<string>}) => void): WebAttribute;
1847
1848  /**
1849   * Triggered when web page requires the user to create a window.
1850   * @param callback The triggered callback when web page requires the user to create a window.
1851   *
1852   * @since 9
1853   */
1854  onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetUrl: string,
1855      handler: ControllerHandler}) => void): WebAttribute;
1856
1857  /**
1858   * Triggered when web page requires the user to close a window.
1859   * @param callback The triggered callback when web page requires the user to close a window.
1860   *
1861   * @since 9
1862   */
1863  onWindowExit(callback: () => void): WebAttribute;
1864
1865  /**
1866   * Set whether multiple windows are supported.
1867   * @param multiWindow True if it needs to be triggered manually by the user else false.
1868   *
1869   * @since 9
1870   */
1871  multiWindowAccess(multiWindow: boolean): WebAttribute;
1872
1873  /**
1874   * Key events notify the application before the WebView consumes them.
1875   * @param event Key event info.
1876   *
1877   * @returns True if the application consumes key events else false.
1878   * @since 9
1879   */
1880  onInterceptKeyEvent(callback: (event: KeyEvent) => boolean): WebAttribute;
1881
1882  /**
1883   * Set the font of webview standard font library. The default font is "sans serif".
1884   * @param family Standard font set series.
1885   *
1886   * @since 9
1887   */
1888  webStandardFont(family: string): WebAttribute;
1889
1890  /**
1891   * Set the font of webview serif font library. The default font is "serif".
1892   * @param family Serif font set series.
1893   *
1894   * @since 9
1895   */
1896  webSerifFont(family: string): WebAttribute;
1897
1898  /**
1899   * Set the font of webview sans serif font library. The default font is "sans-serif".
1900   * @param family Sans serif font set series.
1901   *
1902   * @since 9
1903   */
1904  webSansSerifFont(family: string): WebAttribute;
1905
1906  /**
1907   * Set the font of webview fixed font library. The default font is "monospace".
1908   * @param family Fixed font set series.
1909   *
1910   * @since 9
1911   */
1912  webFixedFont(family: string): WebAttribute;
1913
1914  /**
1915   * Set the font of webview fantasy font library. The default font is "fantasy".
1916   * @param family fantasy font set series.
1917   *
1918   * @since 9
1919   */
1920  webFantasyFont(family: string): WebAttribute;
1921
1922  /**
1923   * Set the font of webview cursive font library. The default font is "cursive".
1924   * @param family Cursive font set series.
1925   *
1926   * @since 9
1927   */
1928  webCursiveFont(family: string): WebAttribute;
1929
1930  /**
1931   * Set the default fixed font value of webview. The default value is 13, ranging from 1 to 72.
1932   * @param size Font size.
1933   *
1934   * @since 9
1935   */
1936  defaultFixedFontSize(size: number): WebAttribute;
1937
1938  /**
1939  * Set the default font value of webview. The default value is 16, ranging from 1 to 72.
1940  * @param size Font size.
1941  *
1942  * @since 9
1943  */
1944  defaultFontSize(size: number): WebAttribute;
1945
1946  /**
1947  * Set the minimum value of webview font. The default value is 8, ranging from 1 to 72.
1948  * @param size Font size.
1949  *
1950  * @since 9
1951  */
1952  minFontSize(size: number): WebAttribute;
1953
1954  /**
1955  * Set the logical minimum value of webview font. The default value is 8, ranging from 1 to 72.
1956  * @param size Font size.
1957  *
1958  * @since 9
1959  */
1960  minLogicalFontSize(size: number): WebAttribute;
1961
1962  /**
1963   * Whether web component can load resource from network.
1964   * @param block {@code true} means it can't load resource from network; {@code false} otherwise.
1965   *
1966   * @since 9
1967   */
1968  blockNetwork(block: boolean): WebAttribute;
1969
1970  /**
1971   * Set whether paint horizontal scroll bar.
1972   * @param horizontalScrollBar True if it needs to paint horizontal scroll bar.
1973   *
1974   * @since 9
1975   */
1976  horizontalScrollBarAccess(horizontalScrollBar: boolean): WebAttribute;
1977
1978  /**
1979   * Set whether paint vertical scroll bar.
1980   * @param verticalScrollBar True if it needs to paint vertical scroll bar.
1981   *
1982   * @since 9
1983   */
1984  verticalScrollBarAccess(verticalScrollBar: boolean): WebAttribute;
1985
1986  /**
1987   * Triggered when the application receive the url of an apple-touch-icon.
1988   * @param callback The triggered callback when the application receive an new url of an
1989   * apple-touch-icon.
1990   * @since 9
1991   */
1992  onTouchIconUrlReceived(callback: (event: {url: string,
1993       precomposed: boolean}) => void): WebAttribute;
1994
1995  /**
1996   * Triggered when the application receive a new favicon for the current web page.
1997   * @param callback The triggered callback when the application receive a new favicon for the
1998   * current web page.
1999   * @since 9
2000   */
2001  onFaviconReceived(callback: (event: {favicon: PixelMap}) => void): WebAttribute;
2002
2003  /**
2004   * Triggered when previous page will no longer be drawn and next page begin to draw.
2005   * @param callback The triggered callback when previous page will no longer be drawn and next
2006   * page begin to draw.
2007   * @since 9
2008   */
2009  onPageVisible(callback: (event: {url: string}) => void): WebAttribute;
2010
2011  /**
2012   * Triggered when the form could be resubmitted.
2013   * @param callback The triggered callback to decision whether resend form data or not.
2014   * @since 9
2015   */
2016  onDataResubmitted(callback: (event: {handler: DataResubmissionHandler}) => void): WebAttribute;
2017
2018  /**
2019   * Set whether enable pinch smooth mode.
2020   * @param isEnabled True if it needs to enable smooth mode.
2021   * @since 9
2022   */
2023  pinchSmooth(isEnabled: boolean): WebAttribute;
2024}
2025
2026/**
2027 * Defines Web Component.
2028 * @since 8
2029 */
2030declare const Web: WebInterface;
2031
2032/**
2033 * Defines Web Component instance.
2034 * @since 8
2035 */
2036declare const WebInstance: WebAttribute;