1 /* 2 * Copyright (c) 2021 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_COMMON_RUNTIME_CONSTANTS_H 17 #define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_COMMON_RUNTIME_CONSTANTS_H 18 19 #include <cstdint> 20 21 namespace OHOS::Ace::Framework { 22 23 constexpr int32_t DEFAULT_APP_ID = 10002; 24 constexpr int32_t FRAGMENT_SIZE = 100; 25 26 #if defined(PREVIEW) 27 constexpr char JS_LOG_TAG[] = "Console"; 28 #else 29 constexpr char JS_LOG_TAG[] = "JSApp"; 30 #endif 31 32 enum class JsLogLevel : int32_t { 33 DEBUG = 0, 34 INFO, 35 WARNING, 36 ERROR, 37 }; 38 39 // JsHandleCallback index 40 constexpr uint32_t PROPERTIES_ARGS_LEN = 2; 41 constexpr uint32_t PROPERTIES_ARGS_CBID_IDX = 0; 42 constexpr uint32_t PROPERTIES_ARGS_RST_IDX = 1; 43 44 // JsDomCreateBody index 45 constexpr uint32_t CREATE_BODY_ARGS_LEN = 5; 46 constexpr uint32_t CREATE_BODY_TAG_IDX = 1; 47 constexpr uint32_t CREATE_BODY_ATTR_IDX = 2; 48 constexpr uint32_t CREATE_BODY_STYLE_IDX = 3; 49 constexpr uint32_t CREATE_BODY_EVENT_IDX = 4; 50 51 // JsDomAddElement index 52 constexpr uint32_t ADD_ELEMENT_ARGS_LEN = 9; 53 constexpr uint32_t ADD_ELEMENT_PARID_IDX = 0; 54 constexpr uint32_t ADD_ELEMENT_NODEID_IDX = 1; 55 constexpr uint32_t ADD_ELEMENT_TAG_IDX = 2; 56 constexpr uint32_t ADD_ELEMENT_ATTR_IDX = 3; 57 constexpr uint32_t ADD_ELEMENT_STYLE_IDX = 4; 58 constexpr uint32_t ADD_ELEMENT_EVENT_INDEX = 5; 59 constexpr uint32_t ADD_ELEMENT_CUSTOM_INDEX = 6; 60 constexpr uint32_t ADD_ELEMENT_ITEM_INDEX = 7; 61 constexpr uint32_t ADD_ELEMENT_INSTANCE_ID = 8; 62 63 // JsUpdateElement index 64 constexpr uint32_t UPLOAD_ELEMENT_ARGS_LEN = 3; 65 constexpr uint32_t UPLOAD_ELEMENT_NID_IDX = 0; 66 constexpr uint32_t UPLOAD_ELEMENT_DOM_IDX = 1; 67 constexpr uint32_t UPLOAD_ELEMENT_INSTANCE_ID = 2; 68 69 // JsRemoveElement index 70 constexpr uint32_t REMOVE_ELEMENT_ARGS_LEN = 2; 71 constexpr uint32_t REMOVE_ELEMENT_ID_IDX = 0; 72 constexpr uint32_t REMOVE_ELEMENT_INSTANCE_ID = 1; 73 74 // JsCallNative index 75 constexpr uint32_t NATIVE_ARGS_LEN = 2; 76 constexpr uint32_t NATIVE_ARGS_METHOD_IDX = 0; 77 constexpr uint32_t NATIVE_ARGS_IDX = 1; 78 79 // JsCallComponent index 80 constexpr uint32_t COMPONENT_ARGS_LEN = 3; 81 constexpr uint32_t COMPONENT_ARGS_ID_IDX = 0; 82 constexpr uint32_t COMPONENT_ARGS_METHOD_IDX = 1; 83 constexpr uint32_t COMPONENT_ARGS_IDX = 2; 84 85 // JsPerf index 86 constexpr uint32_t PERF_ARGS_LEN = 1; 87 constexpr uint32_t PERF_ARGS_METHOD_IDX = 0; 88 89 // JsHiViewReport index 90 constexpr uint32_t HIVIEW_ARGS_LEN = 2; 91 constexpr uint32_t HIVIEW_ARGS_ID_IDX = 0; 92 constexpr uint32_t HIVIEW_ARGS_JSON_IDX = 1; 93 94 // GetPackageInfo index 95 constexpr uint32_t PAG_INFO_ARGS_LEN = 2; 96 constexpr uint32_t PAG_INFO_ARGS_MSG_IDX = 0; 97 constexpr uint32_t PAG_INFO_ARGS_ID_IDX = 1; 98 99 constexpr uint32_t URL_SOURCE_START_IDX = 5; 100 constexpr uint32_t URL_SOURCE_SUFFIX_LEN = 7; 101 } // namespace OHOS::Ace::Framework 102 103 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_COMMON_RUNTIME_CONSTANTS_H 104