• 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 
16 #include "frameworks/bridge/js_frontend/engine/common/js_constants.h"
17 
18 namespace OHOS::Ace::Framework {
19 
20 const int32_t JS_CALL_FAIL = -1;
21 const int32_t JS_CALL_SUCCESS = 0;
22 // To solve the problem of stack overflow when qjs runs JS_Eval() after the context is generated.
23 const int32_t MAX_STACK_SIZE = -1;
24 
25 // for pc preview
26 #if defined(PREVIEW)
27 const char PC_PREVIEW[] = "enable";
28 #else
29 const char PC_PREVIEW[] = "disable";
30 #endif
31 
32 // for common
33 const char COMMON_SUCCESS[] = "success";
34 const char COMMON_FAIL[] = "fail";
35 const char COMMON_COMPLETE[] = "complete";
36 const char COMMON_CANCEL[] = "cancel";
37 
38 // for page route
39 const char ROUTE_PAGE_PUSH[] = "push";
40 const char ROUTE_PAGE_REPLACE[] = "replace";
41 const char ROUTE_PAGE_BACK[] = "back";
42 const char ROUTE_PAGE_CLEAR[] = "clear";
43 const char ROUTE_PAGE_GET_LENGTH[] = "getLength";
44 const char ROUTE_PAGE_GET_STATE[] = "getState";
45 const char ROUTE_PAGE_GET_PARAMS[] = "getParams";
46 const char ROUTE_KEY_URI[] = "uri";
47 const char ROUTE_KEY_PATH[] = "path";
48 const char ROUTE_KEY_PARAMS[] = "params";
49 const char ROUTE_KEY_DONT_OVERWRITE[] = "dontOverwrite";
50 const char ROUTE_ENABLE_ALERT_BEFORE_BACK_PAGE[] = "enableAlertBeforeBackPage";
51 const char ROUTE_DISABLE_ALERT_BEFORE_BACK_PAGE[] = "disableAlertBeforeBackPage";
52 const char ROUTE_POSTPONE[] = "postpone";
53 const char ROUTE_LAUNCH[] = "launch";
54 
55 // for prompt
56 const char PROMPT_SHOW_TOAST[] = "showToast";
57 const char PROMPT_KEY_MESSAGE[] = "message";
58 const char PROMPT_KEY_DURATION[] = "duration";
59 const char PROMPT_KEY_BOTTOM[] = "bottom";
60 const char PROMPT_SHOW_DIALOG[] = "showDialog";
61 const char PROMPT_KEY_TITLE[] = "title";
62 const char PROMPT_KEY_BUTTONS[] = "buttons";
63 const char PROMPT_DIALOG_AUTO_CANCEL[] = "autocancel";
64 const char PROMPT_SHOW_ACTION_MENU[] = "showActionMenu";
65 
66 // for measure
67 const char MEASURE_TEXT[] = "measure";
68 const char MEASURE_KEY_TEXT_CONTENT[] = "textContent";
69 const char MEASURE_KEY_FONTSIZE[] = "fontSize";
70 const char MEASURE_KEY_FONTSTYLE[] = "fontStyle";
71 const char MEASURE_KEY_FONTWEIGHT[] = "fontWeight";
72 const char MEASURE_KEY_FONTFAMILY[] = "fontFamily";
73 const char MEASURE_KEY_LETTER_SPACING[] = "letterSpacing";
74 
75 // for callback
76 const char APP_DESTROY_FINISH[] = "appDestroyFinish";
77 const char CALLBACK_NATIVE[] = "callbackNative";
78 const char KEY_STEPPER_PENDING_INDEX[] = "pendingIndex";
79 
80 // for configuration
81 const char CONFIGURATION_GET_LOCALE[] = "getLocale";
82 const char CONFIGURATION_SET_LOCALE[] = "setLocale";
83 const char LOCALE_LANGUAGE[] = "language";
84 const char LOCALE_COUNTRY_OR_REGION[] = "countryOrRegion";
85 const char LOCALE_UNICODE_SETTING[] = "unicodeSetting";
86 const char LOCALE_TEXT_DIR[] = "dir";
87 const char LOCALE_TEXT_DIR_LTR[] = "ltr";
88 const char LOCALE_TEXT_DIR_RTL[] = "rtl";
89 
90 // for mediaquery
91 const char ADD_LISTENER[] = "addListener";
92 const char GET_DEVICE_TYPE[] = "getDeviceType";
93 
94 // for timer
95 const char SET_TIMEOUT[] = "setTimeout";
96 const char CLEAR_TIMEOUT[] = "clearTimeout";
97 const char CLEAR_INTERVAL[] = "clearInterval";
98 const char SET_INTERVAL[] = "setInterval";
99 const char CAN_IUSE[] = "canIUse";
100 
101 // for app
102 const char APP_GET_INFO[] = "getInfo";
103 const char APP_TERMINATE[] = "terminate";
104 const char APP_GET_PACKAGE_INFO[] = "getPackageInfo";
105 const char APP_PACKAGE_NAME[] = "packageName";
106 const char APP_REQUEST_FULL_WINDOW[] = "requestFullWindow";
107 const char APP_SCREEN_ON_VISIBLE[] = "screenOnVisible";
108 const char APP_SET_SWIPE_TO_DISMISS[] = "setSwipeToDismiss";
109 const char APP_REQUEST_FULL_WINDOW_DURATION[] = "duration";
110 const char APP_SCREEN_ON_VISIBLE_FLAG[] = "visible";
111 const char APP_SET_IMAGE_CACHE_COUNT[] = "setImageCacheCount";
112 const char APP_SET_IMAGE_RAWDATA_CACHE_SIZE[] = "setImageRawDataCacheSize";
113 const char APP_SET_IMAGE_FILE_CACHE_SIZE[] = "setImageFileCacheSize";
114 
115 // for animation
116 const char ANIMATION_REQUEST_ANIMATION_FRAME[] = "requestAnimationFrame";
117 const char ANIMATION_CANCEL_ANIMATION_FRAME[] = "cancelAnimationFrame";
118 
119 // for animator
120 const char ANIMATOR_CREATE_ANIMATOR[] = "createAnimator";
121 const char ANIMATOR_CREATE[] = "create";
122 
123 // for curves
124 const char CURVES_INIT[] = "init";
125 const char INIT_CURVE[] = "initCurve";
126 const char CURVES_CUBIC_BEZIER[] = "cubicBezier";
127 const char CUBIC_BEZIER_CURVE[] = "cubicBezierCurve";
128 const char CURVES_SPRING[] = "spring";
129 const char SPRING_CURVE[] = "springCurve";
130 const char CURVES_STEPS[] = "steps";
131 const char STEPS_CURVE[] = "stepsCurve";
132 const char CURVE_INTERPOLATE[] = "interpolate";
133 const char SPRING_MOTION[] = "springMotion";
134 const char RESPONSIVE_SPRING_MOTION[] = "responsiveSpringMotion";
135 const char DOM_ANIMATION_TIMING_FUNCTION_SPRING_MOTION[] = "spring-motion";
136 const char DOM_ANIMATION_TIMING_FUNCTION_RESPONSIVE_SPRING_MOTION[] = "responsive-spring-motion";
137 
138 // for grid
139 const char GRID_GET_SYSTEM_LAYOUT_INFO[] = "getSystemLayoutInfo";
140 // for plugin
141 const int32_t PLUGIN_REQUEST_SUCCESS = 0;
142 const int32_t PLUGIN_REQUEST_FAIL = 200;
143 const int32_t PLUGIN_CALLBACK_DESTROY = 3;
144 
145 // for offscreenCanvas
146 const char OFFSCREEN_CANVAS_CREATE[] = "create";
147 
148 // for readResource
149 const char READ_TEXT[] = "readText";
150 const char READ_ARRAY_BUFFER[] = "readArrayBuffer";
151 const char READ_KEY_URI[] = "uri";
152 const char READ_KEY_POSITION[] = "position";
153 const char READ_KEY_LENGTH[] = "length";
154 
155 // for matrix
156 const char MATRIX_INIT[] = "init";
157 const char MATRIX_IDENTITY[] = "identity";
158 const char MATRIX_COPY[] = "copy";
159 const char MATRIX_COMBINE[] = "combine";
160 const char MATRIX_INVERT[] = "invert";
161 const char MATRIX_TRANSLATE[] = "translate";
162 const char MATRIX_SCALE[] = "scale";
163 const char MATRIX_ROTATE[] = "rotate";
164 const char MATRIX_TRANSFORM_POINT[] = "transformPoint";
165 const char MATRIX_4X4[] = "matrix4x4";
166 } // namespace OHOS::Ace::Framework
167