1 /* 2 * Copyright (c) 2020 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 #ifndef OHOS_ACELITE_REQUIRE_MODULE_H 16 #define OHOS_ACELITE_REQUIRE_MODULE_H 17 18 #include "non_copyable.h" 19 #include "presets/preset_module.h" 20 21 namespace OHOS { 22 namespace ACELite { 23 class RequireModule final : public PresetModule { 24 public: 25 ACE_DISALLOW_COPY_AND_MOVE(RequireModule); 26 /** 27 * @fn RequireModule::RequireModule() 28 * 29 * @brief Constructor. 30 */ RequireModule()31 RequireModule() : PresetModule(nullptr) {} 32 33 /** 34 * @fn RequireModule::~RequireModule() 35 * 36 * @brief Constructor. 37 */ 38 ~RequireModule() = default; 39 40 void Init() override; 41 Load()42 static void Load() 43 { 44 RequireModule requireModule; 45 requireModule.Init(); 46 } 47 48 private: 49 static jerry_value_t ImportModule(const jerry_value_t func, 50 const jerry_value_t obj, 51 const jerry_value_t *args, 52 const jerry_length_t argsNum); 53 }; 54 } // namespace ACELite 55 } // namespace OHOS 56 #endif // OHOS_ACELITE_REQUIRE_MODULE_H 57