diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/ohos.observer.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/ohos.observer.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1b4aa403d1e777a04688adac0a589e8e23f3bae --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/ohos.observer.ts @@ -0,0 +1,68 @@ +import { InteropNativeModule, runtimeType, RuntimeType } from "@koalaui/interop"; +import { NavPathStack } from "./src/component/navigation" +import { ResourceStr } from "./src/component/units" +import { UIContext, UIObserver } from "./ohos.arkui.UIContext" + +type Any = Object | undefined | null; + +export namespace observer { + export interface UIObserver { + on(type: string, callback: () => void): void; + + off(type: string, callback?: () => void): void; + } + export function createUIObserver(id: number): UIObserver | null { + return null + } + + export interface NavigationInfo { + navigationId: string; + pathStack: NavPathStack; + } + + export enum NavDestinationState { + ON_SHOWN = 0, + ON_HIDDEN = 1, + ON_APPEAR = 2, + ON_DISAPPEAR = 3, + ON_WILL_SHOW = 4, + ON_WILL_HIDE = 5, + ON_WILL_APPEAR = 6, + ON_WILL_DISAPPEAR = 7, + ON_BACKPRESS = 100 + } + + export interface NavDestinationInfo { + navigationId: ResourceStr; + name: ResourceStr; + state: NavDestinationState; + index: number; + param?: Object; + navDestinationId: string; + } + + export enum RouterPageState { + ABOUT_TO_APPEAR = 0, + ABOUT_TO_DISAPPEAR = 1, + ON_PAGE_SHOW = 2, + ON_PAGE_HIDE = 3, + ON_BACK_PRESS = 4 + } + + export class RouterPageInfo { + context: UIContext = new UIContext(100000); // tbd: UIAbilityContext + index: number = -1; + name: string = 'a'; + path: string = 'b'; + state: observer.RouterPageState = observer.RouterPageState.ABOUT_TO_APPEAR; + pageId: string = '1'; + static transferStatic(input: Any): Object { + InteropNativeModule._NativeLog("AceRouter:: enter RouterPageInfo transferStatic") + return new Object() + } + static transferDynamic(input: Object): Any { + InteropNativeModule._NativeLog("AceRouter:: enter RouterPageInfo transferDynamic") + return new Object() as Any + } + } +}