• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PAGE_TRANSITION_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PAGE_TRANSITION_H
18 
19 #include "frameworks/base/json/json_util.h"
20 #include "frameworks/base/memory/ace_type.h"
21 #include "frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h"
22 #include "frameworks/core/components/page_transition/page_transition_info.h"
23 
24 namespace OHOS::Ace::Framework {
25 
26 class JSPageTransition : public AceType {
27     DECLARE_ACE_TYPE(JSPageTransition, AceType);
28 
29 public:
30     JSPageTransition() = default;
31     ~JSPageTransition() override = default;
32 
33     static void JSBind(BindingTarget globalObj);
34 
35     static void Create(const JSCallbackInfo& info);
36     static void Pop();
37 
38     static void Slide(const JSCallbackInfo& info);
39     static void Translate(const JSCallbackInfo& info);
40     static void Scale(const JSCallbackInfo& info);
41     static void Opacity(const JSCallbackInfo& info);
42 
43     static void JsHandlerOnEnter(const JSCallbackInfo& info);
44     static void JsHandlerOnExit(const JSCallbackInfo& info);
45 
46 protected:
47     static PageTransitionOption ParseTransitionOption(const JSRef<JSVal>& transitionArgs);
48 };
49 
50 class JSPageTransitionEnter final : public JSPageTransition {
51     DECLARE_ACE_TYPE(JSPageTransitionEnter, JSPageTransition);
52 
53 public:
54     static void Create(const JSCallbackInfo& info);
55     // for partial update
Pop()56     static void Pop() {};
57 };
58 
59 class JSPageTransitionExit final : public JSPageTransition {
60     DECLARE_ACE_TYPE(JSPageTransitionExit, JSPageTransition);
61 
62 public:
63     static void Create(const JSCallbackInfo& info);
Pop()64     static void Pop() {};
65 };
66 
67 } // namespace OHOS::Ace::Framework
68 
69 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PAGE_TRANSITION_H
70