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 OHOS_ACELITE_LAZY_LOAD_WATCHER_H
17 #define OHOS_ACELITE_LAZY_LOAD_WATCHER_H
18 
19 #include "jerryscript-core.h"
20 #include "js_fwk_common.h"
21 #include "non_copyable.h"
22 
23 namespace OHOS {
24 namespace ACELite {
25 class LazyLoadWatcher final : public MemoryHeap {
26 public:
27     ACE_DISALLOW_COPY_AND_MOVE(LazyLoadWatcher);
28 
29     LazyLoadWatcher(jerry_value_t nativeElement, jerry_value_t attrName, jerry_value_t getter, uint16_t keyId);
30 
31     ~LazyLoadWatcher();
32 
GetNativeElement()33     jerry_value_t GetNativeElement() const
34     {
35         return nativeElement_;
36     }
37 
GetAttrName()38     jerry_value_t GetAttrName() const
39     {
40         return attrName_;
41     }
42 
GetAttrGetter()43     jerry_value_t GetAttrGetter() const
44     {
45         return getter_;
46     }
47 
GetKeyId()48     uint16_t GetKeyId() const
49     {
50         return keyId_;
51     }
52 private:
53     jerry_value_t nativeElement_;
54     jerry_value_t attrName_;
55     jerry_value_t getter_;
56     uint16_t keyId_;
57 };
58 } // namespace ACELite
59 } // namespace OHOS
60 #endif // OHOS_ACELITE_LAZY_LOAD_WATCHER_H
61