Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
d9102fcd
U
uni-app
项目概览
DCloud
/
uni-app
6 个月 前同步成功
通知
751
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
d9102fcd
编写于
6月 17, 2024
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(harmony): build ext api
上级
c48b667e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
16 addition
and
9 deletion
+16
-9
packages/uni-app-harmony/dist/uni-api-shared.ets
packages/uni-app-harmony/dist/uni-api-shared.ets
+6
-0
packages/uni-app-harmony/dist/uni.api.ets
packages/uni-app-harmony/dist/uni.api.ets
+10
-9
未找到文件。
packages/uni-app-harmony/dist/uni-api-shared.ets
浏览文件 @
d9102fcd
...
...
@@ -2,6 +2,10 @@ import { defineAsyncApi as originalDefineAsyncApi, defineOffApi as originalDefin
type Anything = Object | null | undefined;
type NullType = null | undefined;
type FormatArgsValueType = Function | string | number | boolean;
interface AsyncApiSuccessResult {
}
interface AsyncApiResult {
}
interface ErrRes {
errMsg?: string | null;
errCode?: number | null;
...
...
@@ -103,6 +107,8 @@ function defineOffApi<T>(name: string, fn: () => void, options: ApiOptions<T>):
const originalOptions = buildOptions(options as ApiOptions<AsyncMethodOptionLike>);
return originalDefineOffApi(name, fn, originalOptions);
}
export { AsyncApiSuccessResult as AsyncApiSuccessResult };
export { AsyncApiResult as AsyncApiResult };
export { ErrRes as ErrRes };
export { ApiExcutor as ApiExcutor };
export { ProtocolOptions as ProtocolOptions };
...
...
packages/uni-app-harmony/dist/uni.api.ets
浏览文件 @
d9102fcd
import { IUniError, UTSObject, UniError, UTSJSONObject, string,
AsyncApiSuccessResult, AsyncApiResult,
ComponentPublicInstance, ComponentInternalInstance } from './uts'
import { defineAsyncApi, defineSyncApi, defineTaskApi, defineOnApi, defineOffApi, ApiExcutor, ProtocolOptions, ApiOptions, ErrRes } from './uni-api-shared'
import { IUniError, UTSObject, UniError, UTSJSONObject, string, ComponentPublicInstance, ComponentInternalInstance } from './uts'
import { defineAsyncApi, defineSyncApi, defineTaskApi, defineOnApi, defineOffApi, A
syncApiSuccessResult, AsyncApiResult, A
piExcutor, ProtocolOptions, ApiOptions, ErrRes } from './uni-api-shared'
import bundleManager from '@ohos.bundle.bundleManager';
import deviceInfo from '@ohos.deviceInfo';
...
...
@@ -33,6 +33,7 @@ import { getOSRuntime, getCurrentPage as getCurrentPage1 } from "../../../resour
import { getRealPath as getRealPath1 } from "../../../resources/rawfile/uni-app/uni-app-harmony-framework-dev";
import { getRealPath as getRealPath2, Emitter as Emitter1 } from "../../../resources/rawfile/uni-app/uni-app-harmony-framework-dev";
import { getRealPath } from "../../../resources/rawfile/uni-app/uni-app-harmony-framework-dev";
import harmonyWindow from '@ohos.window';
import harmonyWindow1 from '@ohos.window';
import http1 from '@ohos.net.http';
import http2 from '@ohos.net.http';
...
...
@@ -607,14 +608,14 @@ export function initUniExtApi(APP_ID: string) {
};
const internalGetWindowInfo = (): GetWindowInfoResult =>{
const pixelRatio = vp2px(1);
const windowStage: harmonyWindow
1
.WindowStage = UTSHarmony3.getWindowStage();
let topRect: harmonyWindow
1
.Rect = {
const windowStage: harmonyWindow.WindowStage = UTSHarmony3.getWindowStage();
let topRect: harmonyWindow.Rect = {
top: 0,
left: 0,
width: 0,
height: 136
};
let bottomRect: harmonyWindow
1
.Rect = {
let bottomRect: harmonyWindow.Rect = {
top: 0,
left: 0,
width: 0,
...
...
@@ -622,8 +623,8 @@ export function initUniExtApi(APP_ID: string) {
};
if (windowStage) {
const mainWindow = windowStage.getMainWindowSync();
topRect = mainWindow.getWindowAvoidArea(harmonyWindow
1
.AvoidAreaType.TYPE_SYSTEM).topRect;
bottomRect = mainWindow.getWindowAvoidArea(harmonyWindow
1
.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect;
topRect = mainWindow.getWindowAvoidArea(harmonyWindow.AvoidAreaType.TYPE_SYSTEM).topRect;
bottomRect = mainWindow.getWindowAvoidArea(harmonyWindow.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect;
}
const defaultDisplay = display.getDefaultDisplaySync();
const currentPage: ESObject = getCurrentPage();
...
...
@@ -2618,11 +2619,11 @@ export function initUniExtApi(APP_ID: string) {
const API_RPX2PX = 'rpx2px';
const EPS = 1e-4;
const rpx2px: Rpx2px = defineSyncApi<number>(API_RPX2PX, (number: number): number =>{
const windowStage: harmonyWindow.WindowStage = UTSHarmony6.getWindowStage();
const windowStage: harmonyWindow
1
.WindowStage = UTSHarmony6.getWindowStage();
let windowWidthInVp: number = 384;
let windowWidthInPx: number = 1344;
if (windowStage) {
const mainWindow: harmonyWindow.Window = windowStage.getMainWindowSync();
const mainWindow: harmonyWindow
1
.Window = windowStage.getMainWindowSync();
windowWidthInPx = mainWindow.getWindowProperties().windowRect.width;
windowWidthInVp = px2vp(windowWidthInPx);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录