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 #include "core/components/declaration/common/event.h"
17 
18 #include "core/event/ace_event_helper.h"
19 
20 namespace OHOS::Ace {
21 
FireEvent(const WeakPtr<PipelineContext> & context)22 void EventParam::FireEvent(const WeakPtr<PipelineContext>& context)
23 {
24     auto eventContext = context.Upgrade();
25     if (!eventContext) {
26         return;
27     }
28     auto event = AceAsyncEvent<void()>::Create(eventMarker, context);
29     event();
30 }
31 
FireEvent(const WeakPtr<PipelineContext> & context)32 void TouchEventParam::FireEvent(const WeakPtr<PipelineContext>& context)
33 {
34     auto eventContext = context.Upgrade();
35     if (!eventContext) {
36         return;
37     }
38     auto event = AceAsyncEvent<void(const TouchEventInfo&)>::Create(eventMarker, context);
39     event(touchEvent);
40 }
41 
42 } // namespace OHOS::Ace
43