Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
21bfe6e7
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1610
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
21bfe6e7
编写于
8月 24, 2022
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify 进阶 tab
上级
54ec4951
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
184 addition
and
817 deletion
+184
-817
pages/tabBar/Advance/Advance.vue
pages/tabBar/Advance/Advance.vue
+69
-315
uni_modules/uts-advance/app-android/index.uts
uni_modules/uts-advance/app-android/index.uts
+25
-79
unpackage/dist/dev/app-plus/app-service.js
unpackage/dist/dev/app-plus/app-service.js
+70
-361
unpackage/dist/dev/app-plus/uni_modules/uts-advance/app-android/classes.dex
.../app-plus/uni_modules/uts-advance/app-android/classes.dex
+0
-0
unpackage/dist/dev/app-plus/uni_modules/uts-advance/app-android/index.kt
...dev/app-plus/uni_modules/uts-advance/app-android/index.kt
+19
-61
unpackage/dist/dev/app-plus/uni_modules/uts-advance/app-android/index.kt.map
...app-plus/uni_modules/uts-advance/app-android/index.kt.map
+1
-1
未找到文件。
pages/tabBar/Advance/Advance.vue
浏览文件 @
21bfe6e7
<
template
>
<button
@
click=
"testUtsSync"
>
点击测试uts同步方法
</button>
<view>
测试return:
{{
format
(
testUtsSyncResult
)
}}
<view>
<page-head
:title=
"title"
></page-head>
<view
class=
"uni-btn-v uni-common-mt"
>
<button
type=
"primary"
@
tap=
"testTimer"
>
延迟任务
</button>
<button
type=
"primary"
@
tap=
"testInterval"
>
定时任务
</button>
<button
type=
"primary"
@
tap=
"testClearInterval"
>
关闭定时任务
</button>
</view>
</view>
<button
@
click=
"testUtsSyncWithCallback"
>
点击测试uts带callback的同步方法
</button>
<view>
测试return:
{{
format
(
testUtsSyncWithCallbackResult
.
return
)
}}
</view>
<view>
测试success:
{{
format
(
testUtsSyncWithCallbackResult
.
success
)
}}
</view>
<view>
测试complete:
{{
format
(
testUtsSyncWithCallbackResult
.
complete
)
}}
</view>
<button
@
click=
"testUtsAsync"
>
点击测试uts异步方法
</button>
<view>
测试return:
{{
format
(
testUtsAsyncResult
.
return
)
}}
</view>
<view>
测试success:
{{
format
(
testUtsAsyncResult
.
success
)
}}
</view>
<view>
测试complete:
{{
format
(
testUtsAsyncResult
.
complete
)
}}
</view>
<button
@
click=
"testUtsClassConstructor"
>
点击测试uts class构造函数
</button>
<view>
测试callback:
{{
format
(
testUtsClassConstructorResult
.
callback
)
}}
</view>
<button
@
click=
"testUtsClassStaticProp"
>
点击测试uts class静态属性
</button>
<view>
测试value:
{{
format
(
testUtsClassStaticPropResult
)
}}
</view>
<button
@
click=
"testUtsClassStaticSyncWithCallback"
>
点击测试uts class静态方法
</button>
<view>
测试return:
{{
format
(
testUtsClassStaticSyncWithCallbackResult
.
return
)
}}
</view>
<view>
测试success:
{{
format
(
testUtsClassStaticSyncWithCallbackResult
.
success
)
}}
</view>
<view>
测试complete:
{{
format
(
testUtsClassStaticSyncWithCallbackResult
.
complete
)
}}
</view>
<button
@
click=
"testUtsClassStaticAsync"
>
点击测试uts class静态异步方法
</button>
<view>
测试return:
{{
format
(
testUtsClassStaticAsyncResult
.
return
)
}}
</view>
<view>
测试success:
{{
format
(
testUtsClassStaticAsyncResult
.
success
)
}}
</view>
<view>
测试complete:
{{
format
(
testUtsClassStaticAsyncResult
.
complete
)
}}
</view>
<button
@
click=
"testUtsClassProp"
>
点击测试uts class实例属性
</button>
<view>
测试value:
{{
format
(
testUtsClassPropResult
)
}}
</view>
<button
@
click=
"testUtsClassSyncWithCallback"
>
点击测试uts class实例方法
</button>
<view>
测试return:
{{
format
(
testUtsClassSyncWithCallbackResult
.
return
)
}}
</view>
<view>
测试success:
{{
format
(
testUtsClassSyncWithCallbackResult
.
success
)
}}
</view>
<view>
测试complete:
{{
format
(
testUtsClassSyncWithCallbackResult
.
complete
)
}}
</view>
<button
@
click=
"testUtsClassAsync"
>
点击测试uts class实例异步方法
</button>
<view>
测试return:
{{
format
(
testUtsClassAsyncResult
.
return
)
}}
</view>
<view>
测试success:
{{
format
(
testUtsClassAsyncResult
.
success
)
}}
</view>
<view>
测试complete:
{{
format
(
testUtsClassAsyncResult
.
complete
)
}}
</view>
<button
@
click=
"testAll"
>
点击测试所有
</button>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
}
from
"
vue
"
;
import
{
MAX
,
testSync
,
testSyncWithCallback
,
testAsync
,
Test
,
}
from
"
../../../uni_modules/uts-advance
"
;
<
script
>
import
{
doTimerTask
,
doIntervalTask
,
}
from
"
../../../uni_modules/uts-advance
"
;
console
.
log
(
"
MAX
"
,
MAX
);
const
testUtsSyncResult
=
ref
<
boolean
|
null
>
(
null
);
interface
Result
{
return
:
boolean
|
null
;
success
:
boolean
|
null
;
fail
:
boolean
|
null
;
complete
:
boolean
|
null
;
}
const
testUtsSyncWithCallbackResult
=
reactive
<
Result
>
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
,
});
const
testUtsAsyncResult
=
reactive
<
Result
>
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
,
});
function
testAll
()
{
testUtsSync
();
testUtsSyncWithCallback
();
testUtsAsync
();
testUtsClassConstructor
();
testUtsClassStaticProp
();
testUtsClassStaticSyncWithCallback
();
testUtsClassStaticAsync
();
testUtsClassProp
();
testUtsClassSyncWithCallback
();
testUtsClassAsync
();
}
function
testUtsSync
()
{
testUtsSyncResult
.
value
=
false
;
try
{
if
(
testSync
(
"
dcloud
"
).
msg
===
"
hello dcloud
"
)
{
testUtsSyncResult
.
value
=
true
;
}
}
catch
(
e
)
{
console
.
error
(
"
testUtsSync
"
,
e
);
}
}
function
testUtsSyncWithCallback
()
{
try
{
testUtsSyncWithCallbackResult
.
return
=
false
;
testUtsSyncWithCallbackResult
.
success
=
false
;
// testUtsSyncWithCallbackResult.fail = false;
testUtsSyncWithCallbackResult
.
complete
=
false
;
if
(
testSyncWithCallback
({
type
:
"
success
"
,
success
(
res
)
{
console
.
log
(
"
testSyncWithCallback.success.callback
"
,
res
);
testUtsSyncWithCallbackResult
.
success
=
true
;
},
fail
(
res
)
{
console
.
log
(
"
testSyncWithCallback.fail.callback
"
,
res
);
// testUtsSyncWithCallbackResult.fail = true;
},
complete
(
res
)
{
console
.
log
(
"
testSyncWithCallback.complete.callback
"
,
res
);
testUtsSyncWithCallbackResult
.
complete
=
true
;
},
}).
name
===
"
testSyncWithCallback
"
)
{
testUtsSyncWithCallbackResult
.
return
=
true
;
export
default
{
data
()
{
return
{
title
:
'
UTS进阶示例
'
,
taskId
:
0
}
}
catch
(
e
)
{
}
}
async
function
testUtsAsync
()
{
testUtsAsyncResult
.
return
=
false
;
testUtsAsyncResult
.
success
=
false
;
// testUtsAsyncResult.fail = false;
testUtsAsyncResult
.
complete
=
false
;
try
{
const
res
=
await
testAsync
({
type
:
"
success
"
,
success
(
res
)
{
console
.
log
(
"
testAsync.success.callback
"
,
res
);
testUtsAsyncResult
.
success
=
true
;
},
fail
(
res
)
{
console
.
log
(
"
testAsync.fail.callback
"
,
res
);
onUnload
:
function
(){
},
complete
(
res
)
{
console
.
log
(
"
testAsync.complete.callback
"
,
res
);
testUtsAsyncResult
.
complete
=
true
;
methods
:
{
testTimer
:
function
()
{
doTimerTask
({
start
:
function
(
response
){
uni
.
showToast
({
title
:
response
,
icon
:
'
none
'
});
},
work
:
function
(
response
){
uni
.
showToast
({
title
:
response
,
icon
:
'
none
'
});
if
(
res
.
name
===
"
testAsync
"
)
{
testUtsAsyncResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
function
format
(
v
:
boolean
|
null
)
{
return
v
==
null
?
"
--
"
:
v
?
"
通过
"
:
"
未通过
"
;
}
let
test
:
Test
let
id
=
0
const
testUtsClassConstructorResult
=
reactive
<
{
callback
:
boolean
|
null
}
>
({
callback
:
null
});
function
testUtsClassConstructor
()
{
testUtsClassConstructorResult
.
callback
=
false
id
++
test
=
new
Test
(
id
,
{
name
:
'
name
'
+
id
,
callback
:
(
res
)
=>
{
console
.
log
(
res
)
testUtsClassConstructorResult
.
callback
=
true
}
})
}
const
testUtsClassStaticPropResult
=
ref
<
boolean
|
null
>
(
null
);
function
testUtsClassStaticProp
()
{
testUtsClassStaticPropResult
.
value
=
false
if
(
Test
.
type
===
'
Test
'
)
{
testUtsClassStaticPropResult
.
value
=
true
}
}
const
testUtsClassStaticSyncWithCallbackResult
=
reactive
<
Result
>
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
,
});
function
testUtsClassStaticSyncWithCallback
()
{
try
{
testUtsClassStaticSyncWithCallbackResult
.
return
=
false
;
testUtsClassStaticSyncWithCallbackResult
.
success
=
false
;
// testUtsClassStaticSyncWithCallbackResult.fail = false;
testUtsClassStaticSyncWithCallbackResult
.
complete
=
false
;
if
(
Test
.
testClassStaticSyncWithCallback
({
type
:
"
success
"
,
success
(
res
)
{
console
.
log
(
"
testStaticSyncWithCallback.success.callback
"
,
res
);
testUtsClassStaticSyncWithCallbackResult
.
success
=
true
;
},
fail
(
res
)
{
console
.
log
(
"
testStaticSyncWithCallback.fail.callback
"
,
res
);
// testUtsClassStaticSyncWithCallbackResult.fail = true;
});
},
complete
(
res
)
{
console
.
log
(
"
testStaticSyncWithCallback.complete.callback
"
,
res
);
testUtsClassStaticSyncWithCallbackResult
.
complete
=
true
;
testInterval
:
function
()
{
var
ret
=
doIntervalTask
({
start
:
function
(
response
){
uni
.
showToast
({
title
:
response
,
icon
:
'
none
'
});
},
}).
name
===
"
testSyncWithCallback
"
)
{
testUtsClassStaticSyncWithCallbackResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
const
testUtsClassStaticAsyncResult
=
reactive
<
Result
>
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
,
});
async
function
testUtsClassStaticAsync
()
{
testUtsClassStaticAsyncResult
.
return
=
false
;
testUtsClassStaticAsyncResult
.
success
=
false
;
// testUtsClassStaticAsyncResult.fail = false;
testUtsClassStaticAsyncResult
.
complete
=
false
;
try
{
const
res
=
await
Test
.
testClassStaticAsync
({
type
:
"
success
"
,
success
(
res
)
{
console
.
log
(
"
testAsync.success.callback
"
,
res
);
testUtsClassStaticAsyncResult
.
success
=
true
;
work
:
function
(
response
){
uni
.
showToast
({
title
:
response
,
icon
:
'
none
'
});
},
fail
(
res
)
{
console
.
log
(
"
testAsync.fail.callback
"
,
res
)
;
});
this
.
taskId
=
ret
.
taskId
;
},
complete
(
res
)
{
console
.
log
(
"
testAsync.complete.callback
"
,
res
);
testUtsClassStaticAsyncResult
.
complete
=
true
;
testClearInterval
:
function
()
{
console
.
log
(
this
.
taskId
)
;
},
});
if
(
res
.
name
===
"
testAsync
"
)
{
testUtsClassStaticAsyncResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
const
testUtsClassPropResult
=
ref
<
boolean
|
null
>
(
null
);
function
testUtsClassProp
()
{
if
(
!
test
)
{
testUtsClassConstructor
()
}
testUtsClassPropResult
.
value
=
false
if
(
test
.
id
>
0
)
{
testUtsClassPropResult
.
value
=
true
}
}
const
testUtsClassSyncWithCallbackResult
=
reactive
<
Result
>
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
,
});
function
testUtsClassSyncWithCallback
()
{
if
(
!
test
)
{
testUtsClassConstructor
()
}
try
{
testUtsClassSyncWithCallbackResult
.
return
=
false
;
testUtsClassSyncWithCallbackResult
.
success
=
false
;
// testUtsClassSyncWithCallbackResult.fail = false;
testUtsClassSyncWithCallbackResult
.
complete
=
false
;
if
(
test
.
testClassSyncWithCallback
({
type
:
"
success
"
,
success
(
res
)
{
console
.
log
(
"
testSyncWithCallback.success.callback
"
,
res
);
testUtsClassSyncWithCallbackResult
.
success
=
true
;
},
fail
(
res
)
{
console
.
log
(
"
testSyncWithCallback.fail.callback
"
,
res
);
// testUtsClassSyncWithCallbackResult.fail = true;
},
complete
(
res
)
{
console
.
log
(
"
testSyncWithCallback.complete.callback
"
,
res
);
testUtsClassSyncWithCallbackResult
.
complete
=
true
;
},
}).
name
===
"
testSyncWithCallback
"
)
{
testUtsClassSyncWithCallbackResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
const
testUtsClassAsyncResult
=
reactive
<
Result
>
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
,
});
async
function
testUtsClassAsync
()
{
if
(
!
test
)
{
testUtsClassConstructor
()
}
testUtsClassAsyncResult
.
return
=
false
;
testUtsClassAsyncResult
.
success
=
false
;
// testUtsClassAsyncResult.fail = false;
testUtsClassAsyncResult
.
complete
=
false
;
try
{
const
res
=
await
test
.
testClassAsync
({
type
:
"
success
"
,
success
(
res
)
{
console
.
log
(
"
testAsync.success.callback
"
,
res
);
testUtsClassAsyncResult
.
success
=
true
;
},
fail
(
res
)
{
console
.
log
(
"
testAsync.fail.callback
"
,
res
);
},
complete
(
res
)
{
console
.
log
(
"
testAsync.complete.callback
"
,
res
);
testUtsClassAsyncResult
.
complete
=
true
;
},
});
if
(
res
.
name
===
"
testAsync
"
)
{
testUtsClassAsyncResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
</
script
>
<
style
>
</
style
>
uni_modules/uts-advance/app-android/index.uts
浏览文件 @
21bfe6e7
import { log } from "./utils.uts";
type
AsyncOptions
=
{
type
:
string
;
success
:
(
res
:
string
)
=>
void
;
fail
:
(
res
:
string
)
=>
void
;
complete
:
(
res
:
string
)
=>
void
;
type TimerOptions = {
start
: (res: string) => void;
work
: (res: string) => void;
};
/**
* 导出一个属性
*/
export
const
MAX
=
100
;
/**
* 导出一个同步方法
* @returns
*/
export
function
testSync
(
msg
:
string
)
{
console
.
log
(
"log test"
);
log
(
"log test1"
);
return
{
msg
:
`hello ${msg}`
,
};
}
/**
* 导出一个同步方法(触发了数组越界异常)
*/
export
function
testSyncError
()
{
const
arr
:
string
[]
=
[];
console
.
log
(
arr
[
1
]);
}
/**
* 导出一个带callback的同步方法
* @param opts
*/
export
function
testSyncWithCallback
(
opts
:
AsyncOptions
)
{
if
(
opts
.
type
==
"success"
)
{
opts
.
success
(
"success"
);
}
else
{
opts
.
fail
(
"fail"
);
}
opts
.
complete
(
"complete"
);
return
{
name
:
"testSyncWithCallback"
};
}
/**
* 导出一个异步方法
* @returns
*/
export
async
function
testAsync
(
opts
:
AsyncOptions
)
{
if
(
opts
.
type
==
"success"
)
{
opts
.
success
(
"success"
);
}
else
{
opts
.
fail
(
"fail"
);
}
opts
.
complete
(
"complete"
);
return
{
name
:
"testAsync"
};
export function doTimerTask(opts:TimerOptions) {
opts.start('doTimerTask start');
setTimeout(function() {
opts.work("doTimerTask work");
}, 2000);
return { name: "doTimerTask" };
}
type
TestOptions
=
{
name
:
string
;
callback
:
(
res
:
string
)
=>
void
;
};
export
class
Test
{
id
:
number
;
name
:
string
;
static
type
:
string
=
"Test"
;
constructor
(
id
:
number
,
options
:
TestOptions
)
{
this
.
id
=
id
;
this
.
name
=
options
.
name
;
options
.
callback
(
"Test.constructor"
);
}
static
testClassStaticSyncWithCallback
(
opts
:
AsyncOptions
)
:
UtsJSONObject
{
return
testSyncWithCallback
(
opts
);
}
static
async
testClassStaticAsync
(
opts
:
AsyncOptions
)
:
Promise
<
UtsJSONObject
>
{
const
res
=
await
testAsync
(
opts
);
return
res
;
}
testClassSyncWithCallback
(
opts
:
AsyncOptions
)
:
UtsJSONObject
{
return
testSyncWithCallback
(
opts
);
}
async
testClassAsync
(
opts
:
AsyncOptions
)
:
Promise
<
UtsJSONObject
>
{
const
res
=
await
testAsync
(
opts
);
return
res
;
}
export function doIntervalTask(opts:TimerOptions) {
var taskRet = setInterval(function() {
opts.work("doIntervalTask work");
}, 2000);
opts.start('doIntervalTask start');
return { name: "doIntervalTask",taskId:taskRet};
}
unpackage/dist/dev/app-plus/app-service.js
浏览文件 @
21bfe6e7
var
__defProp
=
Object
.
defineProperty
;
var
__getOwnPropSymbols
=
Object
.
getOwnPropertySymbols
;
var
__hasOwnProp
=
Object
.
prototype
.
hasOwnProperty
;
var
__propIsEnum
=
Object
.
prototype
.
propertyIsEnumerable
;
var
__defNormalProp
=
(
obj
,
key
,
value
)
=>
key
in
obj
?
__defProp
(
obj
,
key
,
{
enumerable
:
true
,
configurable
:
true
,
writable
:
true
,
value
})
:
obj
[
key
]
=
value
;
var
__spreadValues
=
(
a
,
b
)
=>
{
for
(
var
prop
in
b
||
(
b
=
{}))
if
(
__hasOwnProp
.
call
(
b
,
prop
))
__defNormalProp
(
a
,
prop
,
b
[
prop
]);
if
(
__getOwnPropSymbols
)
for
(
var
prop
of
__getOwnPropSymbols
(
b
))
{
if
(
__propIsEnum
.
call
(
b
,
prop
))
__defNormalProp
(
a
,
prop
,
b
[
prop
]);
}
return
a
;
};
if
(
typeof
Promise
!==
"
undefined
"
&&
!
Promise
.
prototype
.
finally
)
{
Promise
.
prototype
.
finally
=
function
(
callback
)
{
const
promise
=
this
.
constructor
;
...
...
@@ -106,12 +90,12 @@ if (uni.restoreGlobal) {
}
}
};
function
_sfc_render$
3
(
_ctx
,
_cache
,
$props
,
$setup
,
$data
,
$options
)
{
function
_sfc_render$
4
(
_ctx
,
_cache
,
$props
,
$setup
,
$data
,
$options
)
{
return
vue
.
openBlock
(),
vue
.
createElementBlock
(
"
view
"
,
{
class
:
"
common-page-head
"
},
[
vue
.
createElementVNode
(
"
view
"
,
{
class
:
"
common-page-head-title
"
},
vue
.
toDisplayString
(
$props
.
title
),
1
)
]);
}
var
__easycom_0
=
/* @__PURE__ */
_export_sfc
(
_sfc_main$5
,
[[
"
render
"
,
_sfc_render$
3
],
[
"
__file
"
,
"
D:/Do/Source/hello-uts/components/page-head/page-head.vue
"
]]);
var
__easycom_0
=
/* @__PURE__ */
_export_sfc
(
_sfc_main$5
,
[[
"
render
"
,
_sfc_render$
4
],
[
"
__file
"
,
"
D:/Do/Source/hello-uts/components/page-head/page-head.vue
"
]]);
function
requireNativePlugin
(
name
)
{
return
weex
.
requireModule
(
name
);
}
...
...
@@ -133,9 +117,6 @@ if (uni.restoreGlobal) {
}
return
arg
;
}
function
initUtsInstanceMethod
(
async
,
opts
)
{
return
initProxyFunction
(
async
,
opts
);
}
function
getProxy
()
{
if
(
!
proxy
)
{
proxy
=
requireNativePlugin
(
"
UTS-Proxy
"
);
...
...
@@ -148,10 +129,6 @@ if (uni.restoreGlobal) {
}
return
res
.
params
;
}
function
invokePropGetter
(
args
)
{
return
resolveSyncResult
(
getProxy
().
invokeSync
(
args
,
()
=>
{
}));
}
function
initProxyFunction
(
async
,
{
package
:
pkg2
,
class
:
cls2
,
name
:
propOrMethod
,
id
:
instanceId
,
companion
})
{
const
invokeCallback
=
({
id
,
name
,
params
,
keepAlive
})
=>
{
const
callback
=
callbacks
[
id
];
...
...
@@ -196,48 +173,6 @@ if (uni.restoreGlobal) {
return
initProxyFunction
(
async
,
opts
);
}
const
initUtsProxyFunction
=
initUtsStaticMethod
;
function
initUtsProxyClass
({
package
:
pkg2
,
class
:
cls2
,
methods
,
props
,
staticProps
,
staticMethods
})
{
const
baseOptions
=
{
package
:
pkg2
,
class
:
cls2
};
const
ProxyClass
=
class
UtsClass
{
constructor
(...
params
)
{
const
target
=
{};
const
instanceId
=
initProxyFunction
(
false
,
shared
.
extend
({
name
:
"
constructor
"
,
params
},
baseOptions
)).
apply
(
null
,
params
);
return
new
Proxy
(
this
,
{
get
(
_
,
name
)
{
if
(
!
target
[
name
])
{
if
(
shared
.
hasOwn
(
methods
,
name
))
{
target
[
name
]
=
initUtsInstanceMethod
(
!!
methods
[
name
].
async
,
shared
.
extend
({
id
:
instanceId
,
name
},
baseOptions
));
}
else
if
(
props
.
includes
(
name
))
{
return
invokePropGetter
({
id
:
instanceId
,
name
});
}
}
return
target
[
name
];
}
});
}
};
const
staticMethodCache
=
{};
return
new
Proxy
(
ProxyClass
,
{
get
(
target
,
name
,
receiver
)
{
if
(
shared
.
hasOwn
(
staticMethods
,
name
))
{
if
(
!
staticMethodCache
[
name
])
{
staticMethodCache
[
name
]
=
initUtsStaticMethod
(
!!
staticMethods
[
name
].
async
,
shared
.
extend
({
name
,
companion
:
true
},
baseOptions
));
}
return
staticMethodCache
[
name
];
}
if
(
staticProps
.
includes
(
name
))
{
return
invokePropGetter
(
shared
.
extend
({
name
,
companion
:
true
},
baseOptions
));
}
return
Reflect
.
get
(
target
,
name
,
receiver
);
}
});
}
const
pkg$2
=
"
uts.modules.utsHelloworld
"
;
const
cls$2
=
"
IndexKt
"
;
const
callWithoutParam
=
initUtsProxyFunction
(
false
,
{
package
:
pkg$2
,
class
:
cls$2
,
name
:
"
callWithoutParam
"
});
...
...
@@ -292,7 +227,7 @@ if (uni.restoreGlobal) {
}
}
};
function
_sfc_render$
2
(
_ctx
,
_cache
,
$props
,
$setup
,
$data
,
$options
)
{
function
_sfc_render$
3
(
_ctx
,
_cache
,
$props
,
$setup
,
$data
,
$options
)
{
const
_component_page_head
=
resolveEasycom
(
vue
.
resolveDynamicComponent
(
"
page-head
"
),
__easycom_0
);
return
vue
.
openBlock
(),
vue
.
createElementBlock
(
"
view
"
,
null
,
[
vue
.
createVNode
(
_component_page_head
,
{
title
:
$data
.
title
},
null
,
8
,
[
"
title
"
]),
...
...
@@ -318,306 +253,80 @@ if (uni.restoreGlobal) {
])
]);
}
var
PagesTabBarPrimerPrimer
=
/* @__PURE__ */
_export_sfc
(
_sfc_main$4
,
[[
"
render
"
,
_sfc_render$
2
],
[
"
__file
"
,
"
D:/Do/Source/hello-uts/pages/tabBar/Primer/Primer.vue
"
]]);
var
PagesTabBarPrimerPrimer
=
/* @__PURE__ */
_export_sfc
(
_sfc_main$4
,
[[
"
render
"
,
_sfc_render$
3
],
[
"
__file
"
,
"
D:/Do/Source/hello-uts/pages/tabBar/Primer/Primer.vue
"
]]);
const
pkg$1
=
"
uts.modules.utsAdvance
"
;
const
cls$1
=
"
IndexKt
"
;
const
MAX
=
100
;
const
testSync
=
initUtsProxyFunction
(
false
,
{
package
:
pkg$1
,
class
:
cls$1
,
name
:
"
testSync
"
});
const
testSyncWithCallback
=
initUtsProxyFunction
(
false
,
{
package
:
pkg$1
,
class
:
cls$1
,
name
:
"
testSyncWithCallback
"
});
const
testAsync
=
initUtsProxyFunction
(
true
,
{
package
:
pkg$1
,
class
:
cls$1
,
name
:
"
testAsync
"
});
const
Test
=
initUtsProxyClass
(
__spreadValues
({
package
:
pkg$1
,
class
:
"
Test
"
},
{
"
methods
"
:
{
"
testClassSyncWithCallback
"
:
{
"
async
"
:
false
},
"
testClassAsync
"
:
{
"
async
"
:
true
}
},
"
staticMethods
"
:
{
"
testClassStaticSyncWithCallback
"
:
{
"
async
"
:
false
},
"
testClassStaticAsync
"
:
{
"
async
"
:
true
}
},
"
props
"
:
[
"
id
"
,
"
name
"
],
"
staticProps
"
:
[
"
type
"
]
}));
const
_sfc_main$3
=
/* @__PURE__ */
vue
.
defineComponent
({
__name
:
"
Advance
"
,
setup
(
__props
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:54
"
,
"
MAX
"
,
MAX
);
const
testUtsSyncResult
=
vue
.
ref
(
null
);
const
testUtsSyncWithCallbackResult
=
vue
.
reactive
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
});
const
testUtsAsyncResult
=
vue
.
reactive
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
});
function
testAll
()
{
testUtsSync
();
testUtsSyncWithCallback
();
testUtsAsync
();
testUtsClassConstructor
();
testUtsClassStaticProp
();
testUtsClassStaticSyncWithCallback
();
testUtsClassStaticAsync
();
testUtsClassProp
();
testUtsClassSyncWithCallback
();
testUtsClassAsync
();
}
function
testUtsSync
()
{
testUtsSyncResult
.
value
=
false
;
try
{
if
(
testSync
(
"
dcloud
"
).
msg
===
"
hello dcloud
"
)
{
testUtsSyncResult
.
value
=
true
;
}
}
catch
(
e
)
{
formatAppLog
(
"
error
"
,
"
at pages/tabBar/Advance/Advance.vue:93
"
,
"
testUtsSync
"
,
e
);
}
}
function
testUtsSyncWithCallback
()
{
try
{
testUtsSyncWithCallbackResult
.
return
=
false
;
testUtsSyncWithCallbackResult
.
success
=
false
;
testUtsSyncWithCallbackResult
.
complete
=
false
;
if
(
testSyncWithCallback
({
type
:
"
success
"
,
success
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:106
"
,
"
testSyncWithCallback.success.callback
"
,
res
);
testUtsSyncWithCallbackResult
.
success
=
true
;
},
fail
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:110
"
,
"
testSyncWithCallback.fail.callback
"
,
res
);
},
complete
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:114
"
,
"
testSyncWithCallback.complete.callback
"
,
res
);
testUtsSyncWithCallbackResult
.
complete
=
true
;
}
}).
name
===
"
testSyncWithCallback
"
)
{
testUtsSyncWithCallbackResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
async
function
testUtsAsync
()
{
testUtsAsyncResult
.
return
=
false
;
testUtsAsyncResult
.
success
=
false
;
testUtsAsyncResult
.
complete
=
false
;
try
{
const
res
=
await
testAsync
({
type
:
"
success
"
,
success
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:132
"
,
"
testAsync.success.callback
"
,
res2
);
testUtsAsyncResult
.
success
=
true
;
const
doTimerTask
=
initUtsProxyFunction
(
false
,
{
package
:
pkg$1
,
class
:
cls$1
,
name
:
"
doTimerTask
"
});
const
doIntervalTask
=
initUtsProxyFunction
(
false
,
{
package
:
pkg$1
,
class
:
cls$1
,
name
:
"
doIntervalTask
"
});
const
_sfc_main$3
=
{
data
()
{
return
{
title
:
"
UTS
\
u8FDB
\
u9636
\
u793A
\
u4F8B
"
,
taskId
:
0
};
},
fail
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:136
"
,
"
testAsync.fail.callback
"
,
res2
);
onUnload
:
function
()
{
},
complete
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:139
"
,
"
testAsync.complete.callback
"
,
res2
);
testUtsAsyncResult
.
complete
=
true
;
}
});
if
(
res
.
name
===
"
testAsync
"
)
{
testUtsAsyncResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
function
format
(
v
)
{
return
v
==
null
?
"
--
"
:
v
?
"
\
u901A
\
u8FC7
"
:
"
\
u672A
\
u901A
\
u8FC7
"
;
}
let
test
;
let
id
=
0
;
const
testUtsClassConstructorResult
=
vue
.
reactive
({
callback
:
null
methods
:
{
testTimer
:
function
()
{
doTimerTask
({
start
:
function
(
response
)
{
uni
.
showToast
({
title
:
response
,
icon
:
"
none
"
});
function
testUtsClassConstructor
()
{
testUtsClassConstructorResult
.
callback
=
false
;
id
++
;
test
=
new
Test
(
id
,
{
name
:
"
name
"
+
id
,
callback
:
(
res
)
=>
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:161
"
,
res
);
testUtsClassConstructorResult
.
callback
=
true
;
}
},
work
:
function
(
response
)
{
uni
.
showToast
({
title
:
response
,
icon
:
"
none
"
});
}
const
testUtsClassStaticPropResult
=
vue
.
ref
(
null
);
function
testUtsClassStaticProp
()
{
testUtsClassStaticPropResult
.
value
=
false
;
if
(
Test
.
type
===
"
Test
"
)
{
testUtsClassStaticPropResult
.
value
=
true
;
}
}
const
testUtsClassStaticSyncWithCallbackResult
=
vue
.
reactive
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
});
function
testUtsClassStaticSyncWithCallback
()
{
try
{
testUtsClassStaticSyncWithCallbackResult
.
return
=
false
;
testUtsClassStaticSyncWithCallbackResult
.
success
=
false
;
testUtsClassStaticSyncWithCallbackResult
.
complete
=
false
;
if
(
Test
.
testClassStaticSyncWithCallback
({
type
:
"
success
"
,
success
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:189
"
,
"
testStaticSyncWithCallback.success.callback
"
,
res
);
testUtsClassStaticSyncWithCallbackResult
.
success
=
true
;
},
fail
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:193
"
,
"
testStaticSyncWithCallback.fail.callback
"
,
res
);
},
complete
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:197
"
,
"
testStaticSyncWithCallback.complete.callback
"
,
res
);
testUtsClassStaticSyncWithCallbackResult
.
complete
=
true
;
}
}).
name
===
"
testSyncWithCallback
"
)
{
testUtsClassStaticSyncWithCallbackResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
const
testUtsClassStaticAsyncResult
=
vue
.
reactive
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
testInterval
:
function
()
{
var
ret
=
doIntervalTask
({
start
:
function
(
response
)
{
uni
.
showToast
({
title
:
response
,
icon
:
"
none
"
});
async
function
testUtsClassStaticAsync
()
{
testUtsClassStaticAsyncResult
.
return
=
false
;
testUtsClassStaticAsyncResult
.
success
=
false
;
testUtsClassStaticAsyncResult
.
complete
=
false
;
try
{
const
res
=
await
Test
.
testClassStaticAsync
({
type
:
"
success
"
,
success
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:221
"
,
"
testAsync.success.callback
"
,
res2
);
testUtsClassStaticAsyncResult
.
success
=
true
;
},
fail
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:225
"
,
"
testAsync.fail.callback
"
,
res2
);
},
complete
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:228
"
,
"
testAsync.complete.callback
"
,
res2
);
t
estUtsClassStaticAsyncResult
.
complete
=
true
;
}
work
:
function
(
response
)
{
uni
.
showToast
({
t
itle
:
response
,
icon
:
"
none
"
});
if
(
res
.
name
===
"
testAsync
"
)
{
testUtsClassStaticAsyncResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
const
testUtsClassPropResult
=
vue
.
ref
(
null
);
function
testUtsClassProp
()
{
if
(
!
test
)
{
testUtsClassConstructor
();
}
testUtsClassPropResult
.
value
=
false
;
if
(
test
.
id
>
0
)
{
testUtsClassPropResult
.
value
=
true
;
}
}
const
testUtsClassSyncWithCallbackResult
=
vue
.
reactive
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
});
function
testUtsClassSyncWithCallback
()
{
if
(
!
test
)
{
testUtsClassConstructor
();
}
try
{
testUtsClassSyncWithCallbackResult
.
return
=
false
;
testUtsClassSyncWithCallbackResult
.
success
=
false
;
testUtsClassSyncWithCallbackResult
.
complete
=
false
;
if
(
test
.
testClassSyncWithCallback
({
type
:
"
success
"
,
success
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:268
"
,
"
testSyncWithCallback.success.callback
"
,
res
);
testUtsClassSyncWithCallbackResult
.
success
=
true
;
this
.
taskId
=
ret
.
taskId
;
},
fail
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:272
"
,
"
testSyncWithCallback.fail.callback
"
,
res
);
},
complete
(
res
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:276
"
,
"
testSyncWithCallback.complete.callback
"
,
res
);
testUtsClassSyncWithCallbackResult
.
complete
=
true
;
}
}).
name
===
"
testSyncWithCallback
"
)
{
testUtsClassSyncWithCallbackResult
.
return
=
true
;
testClearInterval
:
function
()
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:62
"
,
this
.
taskId
);
}
}
catch
(
e
)
{
}
}
const
testUtsClassAsyncResult
=
vue
.
reactive
({
return
:
null
,
success
:
null
,
fail
:
null
,
complete
:
null
});
async
function
testUtsClassAsync
()
{
if
(
!
test
)
{
testUtsClassConstructor
();
}
testUtsClassAsyncResult
.
return
=
false
;
testUtsClassAsyncResult
.
success
=
false
;
testUtsClassAsyncResult
.
complete
=
false
;
try
{
const
res
=
await
test
.
testClassAsync
({
type
:
"
success
"
,
success
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:303
"
,
"
testAsync.success.callback
"
,
res2
);
testUtsClassAsyncResult
.
success
=
true
;
},
fail
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:307
"
,
"
testAsync.fail.callback
"
,
res2
);
},
complete
(
res2
)
{
formatAppLog
(
"
log
"
,
"
at pages/tabBar/Advance/Advance.vue:310
"
,
"
testAsync.complete.callback
"
,
res2
);
testUtsClassAsyncResult
.
complete
=
true
;
}
});
if
(
res
.
name
===
"
testAsync
"
)
{
testUtsClassAsyncResult
.
return
=
true
;
}
}
catch
(
e
)
{
}
}
return
(
_ctx
,
_cache
)
=>
{
return
vue
.
openBlock
(),
vue
.
createElementBlock
(
vue
.
Fragment
,
null
,
[
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsSync
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts
\
u540C
\
u6B65
\
u65B9
\
u6CD5
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5return
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsSyncResult
.
value
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsSyncWithCallback
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts
\
u5E26callback
\
u7684
\
u540C
\
u6B65
\
u65B9
\
u6CD5
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5return
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsSyncWithCallbackResult
.
return
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5success
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsSyncWithCallbackResult
.
success
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5complete
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsSyncWithCallbackResult
.
complete
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsAsync
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts
\
u5F02
\
u6B65
\
u65B9
\
u6CD5
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5return
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsAsyncResult
.
return
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5success
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsAsyncResult
.
success
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5complete
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsAsyncResult
.
complete
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsClassConstructor
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts class
\
u6784
\
u9020
\
u51FD
\
u6570
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5callback
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassConstructorResult
.
callback
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsClassStaticProp
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts class
\
u9759
\
u6001
\
u5C5E
\
u6027
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5value
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassStaticPropResult
.
value
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsClassStaticSyncWithCallback
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts class
\
u9759
\
u6001
\
u65B9
\
u6CD5
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5return
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassStaticSyncWithCallbackResult
.
return
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5success
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassStaticSyncWithCallbackResult
.
success
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5complete
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassStaticSyncWithCallbackResult
.
complete
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsClassStaticAsync
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts class
\
u9759
\
u6001
\
u5F02
\
u6B65
\
u65B9
\
u6CD5
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5return
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassStaticAsyncResult
.
return
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5success
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassStaticAsyncResult
.
success
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5complete
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassStaticAsyncResult
.
complete
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsClassProp
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts class
\
u5B9E
\
u4F8B
\
u5C5E
\
u6027
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5value
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassPropResult
.
value
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsClassSyncWithCallback
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts class
\
u5B9E
\
u4F8B
\
u65B9
\
u6CD5
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5return
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassSyncWithCallbackResult
.
return
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5success
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassSyncWithCallbackResult
.
success
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5complete
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassSyncWithCallbackResult
.
complete
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testUtsClassAsync
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5uts class
\
u5B9E
\
u4F8B
\
u5F02
\
u6B65
\
u65B9
\
u6CD5
"
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5return
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassAsyncResult
.
return
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5success
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassAsyncResult
.
success
)),
1
),
vue
.
createElementVNode
(
"
view
"
,
null
,
"
\
u6D4B
\
u8BD5complete
\
uFF1A
"
+
vue
.
toDisplayString
(
format
(
testUtsClassAsyncResult
.
complete
)),
1
),
vue
.
createElementVNode
(
"
button
"
,
{
onClick
:
testAll
},
"
\
u70B9
\
u51FB
\
u6D4B
\
u8BD5
\
u6240
\
u6709
"
)
],
64
);
};
function
_sfc_render$2
(
_ctx
,
_cache
,
$props
,
$setup
,
$data
,
$options
)
{
const
_component_page_head
=
resolveEasycom
(
vue
.
resolveDynamicComponent
(
"
page-head
"
),
__easycom_0
);
return
vue
.
openBlock
(),
vue
.
createElementBlock
(
"
view
"
,
null
,
[
vue
.
createVNode
(
_component_page_head
,
{
title
:
$data
.
title
},
null
,
8
,
[
"
title
"
]),
vue
.
createElementVNode
(
"
view
"
,
{
class
:
"
uni-btn-v uni-common-mt
"
},
[
vue
.
createElementVNode
(
"
button
"
,
{
type
:
"
primary
"
,
onClick
:
_cache
[
0
]
||
(
_cache
[
0
]
=
(...
args
)
=>
$options
.
testTimer
&&
$options
.
testTimer
(...
args
))
},
"
\
u5EF6
\
u8FDF
\
u4EFB
\
u52A1
"
),
vue
.
createElementVNode
(
"
button
"
,
{
type
:
"
primary
"
,
onClick
:
_cache
[
1
]
||
(
_cache
[
1
]
=
(...
args
)
=>
$options
.
testInterval
&&
$options
.
testInterval
(...
args
))
},
"
\
u5B9A
\
u65F6
\
u4EFB
\
u52A1
"
),
vue
.
createElementVNode
(
"
button
"
,
{
type
:
"
primary
"
,
onClick
:
_cache
[
2
]
||
(
_cache
[
2
]
=
(...
args
)
=>
$options
.
testClearInterval
&&
$options
.
testClearInterval
(...
args
))
},
"
\
u5173
\
u95ED
\
u5B9A
\
u65F6
\
u4EFB
\
u52A1
"
)
])
]);
}
});
var
PagesTabBarAdvanceAdvance
=
/* @__PURE__ */
_export_sfc
(
_sfc_main$3
,
[[
"
__file
"
,
"
D:/Do/Source/hello-uts/pages/tabBar/Advance/Advance.vue
"
]]);
var
PagesTabBarAdvanceAdvance
=
/* @__PURE__ */
_export_sfc
(
_sfc_main$3
,
[[
"
render
"
,
_sfc_render$2
],
[
"
__file
"
,
"
D:/Do/Source/hello-uts/pages/tabBar/Advance/Advance.vue
"
]]);
const
pkg
=
"
uts.modules.utsOsapi
"
;
const
cls
=
"
IndexKt
"
;
const
getBatteryCapacity
=
initUtsProxyFunction
(
false
,
{
package
:
pkg
,
class
:
cls
,
name
:
"
getBatteryCapacity
"
});
...
...
unpackage/dist/dev/app-plus/uni_modules/uts-advance/app-android/classes.dex
浏览文件 @
21bfe6e7
无法预览此类型文件
unpackage/dist/dev/app-plus/uni_modules/uts-advance/app-android/index.kt
浏览文件 @
21bfe6e7
...
...
@@ -4,70 +4,28 @@ import kotlinx.coroutines.CoroutineScope;
import
kotlinx.coroutines.Deferred;
import
kotlinx.coroutines.Dispatchers;
import
io.dcloud.uts.*;
fun
log
(
msg
:
String
)
{
console
.
log
(
msg
,
"at uni_modules/uts-advance/app-android/utils.uts:2"
);
}
open
class
AsyncOptions
{
open
lateinit
var
type
:
String
;
open
lateinit
var
success
:
UTSCallback
;
open
lateinit
var
fail
:
UTSCallback
;
open
lateinit
var
complete
:
UTSCallback
;
}
val
MAX
=
100
;
fun
testSync
(
msg
:
String
):
UtsJSONObject
{
console
.
log
(
"log test"
,
"at uni_modules/uts-advance/app-android/index.uts:18"
);
log
(
"log test1"
);
open
class
TimerOptions
{
open
lateinit
var
start
:
UTSCallback
;
open
lateinit
var
work
:
UTSCallback
;
}
fun
doTimerTask
(
opts
:
TimerOptions
):
UtsJSONObject
{
opts
.
start
(
"doTimerTask start"
);
setTimeout
(
fun
()
{
opts
.
work
(
"doTimerTask work"
);
}
,
2000
);
return
object
:
UtsJSONObject
()
{
var
msg
=
"""hello ${msg}""
"
var
name
=
"doTimerTask
"
};
}
fun
testSyncError
()
{
val
arr
:
MutableList
<
String
>
=
mutableListOf
();
console
.
log
(
arr
[
1
],
"at uni_modules/uts-advance/app-android/index.uts:29"
);
}
fun
testSyncWithCallback
(
opts
:
AsyncOptions
):
UtsJSONObject
{
if
(
opts
.
type
==
"success"
)
opts
.
success
(
"success"
);
else
opts
.
fail
(
"fail"
);
opts
.
complete
(
"complete"
);
fun
doIntervalTask
(
opts
:
TimerOptions
):
UtsJSONObject
{
var
taskRet
=
setInterval
(
fun
()
{
opts
.
work
(
"doIntervalTask work"
);
}
,
2000
);
opts
.
start
(
"doIntervalTask start"
);
return
object
:
UtsJSONObject
()
{
var
name
=
"testSyncWithCallback"
};
}
suspend
fun
testAsync
(
opts
:
AsyncOptions
):
Deferred
<
UtsJSONObject
>
=
CoroutineScope
(
Dispatchers
.
Default
).
async
{
if
(
opts
.
type
==
"success"
)
opts
.
success
(
"success"
);
else
opts
.
fail
(
"fail"
);
opts
.
complete
(
"complete"
);
return
@async
object
:
UtsJSONObject
()
{
var
name
=
"testAsync"
var
name
=
"doIntervalTask"
var
taskId
=
taskRet
};
}
open
class
TestOptions
{
open
lateinit
var
name
:
String
;
open
lateinit
var
callback
:
UTSCallback
;
}
open
class
Test
{
open
var
id
:
Number
;
open
var
name
:
String
;
constructor
(
id
:
Number
,
options
:
TestOptions
){
this
.
id
=
id
;
this
.
name
=
options
.
name
;
options
.
callback
(
"Test.constructor"
);
}
open
fun
testClassSyncWithCallback
(
opts
:
AsyncOptions
):
UtsJSONObject
{
return
testSyncWithCallback
(
opts
);
}
open
suspend
fun
testClassAsync
(
opts
:
AsyncOptions
):
Deferred
<
UtsJSONObject
>
=
CoroutineScope
(
Dispatchers
.
Default
).
async
{
val
res
=
testAsync
(
opts
).
await
();
return
@async
res
;
}
companion
object
{
var
type
:
String
=
"Test"
;
fun
testClassStaticSyncWithCallback
(
opts
:
AsyncOptions
):
UtsJSONObject
{
return
testSyncWithCallback
(
opts
);
}
suspend
fun
testClassStaticAsync
(
opts
:
AsyncOptions
):
Deferred
<
UtsJSONObject
>
=
CoroutineScope
(
Dispatchers
.
Default
).
async
{
val
res
=
testAsync
(
opts
).
await
();
return
@async
res
;
}
}
}
unpackage/dist/dev/app-plus/uni_modules/uts-advance/app-android/index.kt.map
浏览文件 @
21bfe6e7
{
"version"
:
3
,
"sources"
:
[
"
\\\\
?
\\
D:
\\
Do
\\
Source
\\
hello-uts
\\
uni_modules
\\
uts-advance
\\
app-android
\\
utils.uts"
,
"
\\\\
?
\\
D:
\\
Do
\\
Source
\\
hello-uts
\\
uni_modules
\\
uts-advance
\\
app-android
\\
index.uts"
],
"sourcesContent"
:
[
"export function log(msg: string) {\n console.log(msg);
\n
}
\n
"
,
"import { log } from
\"
./utils.uts
\"
;
\n
type AsyncOptions = {\n type: string;
\n
success: (res: string) => void;
\n
fail: (res: string) => void;
\n
complete: (res: string) => void;
\n
};
\n
/**
\n
* 导出一个属性
\n
*/
\n
export const MAX = 100;
\n\n
/**
\n
* 导出一个同步方法
\n
* @returns
\n
*/
\n
export function testSync(msg: string) {\n console.log(
\"
log test
\"
);
\n
log(
\"
log test1
\"
);
\n
return {\n msg: `hello ${msg}`,
\n
};
\n
}
\n
/**
\n
* 导出一个同步方法(触发了数组越界异常)
\n
*/
\n
export function testSyncError() {\n const arr: string[] = [];
\n
console.log(arr[1]);
\n
}
\n
/**
\n
* 导出一个带callback的同步方法
\n
* @param opts
\n
*/
\n
export function testSyncWithCallback(opts: AsyncOptions) {\n if (opts.type ==
\"
success
\"
) {\n opts.success(
\"
success
\"
);
\n
} else {\n opts.fail(
\"
fail
\"
);
\n
}
\n
opts.complete(
\"
complete
\"
);
\n
return { name:
\"
testSyncWithCallback
\"
};
\n
}
\n
/**
\n
* 导出一个异步方法
\n
* @returns
\n
*/
\n
export async function testAsync(opts: AsyncOptions) {\n if (opts.type ==
\"
success
\"
) {\n opts.success(
\"
success
\"
);
\n
} else {\n opts.fail(
\"
fail
\"
);
\n
}
\n
opts.complete(
\"
complete
\"
);
\n
return { name:
\"
testAsync
\"
};
\n
}
\n\n
type TestOptions = {\n name: string;
\n
callback: (res: string) => void;
\n
};
\n\n
export class Test {\n id: number;
\n
name: string;
\n
static type: string =
\"
Test
\"
;
\n
constructor(id: number, options: TestOptions) {\n this.id = id;
\n
this.name = options.name;
\n
options.callback(
\"
Test.constructor
\"
);
\n
}
\n
static testClassStaticSyncWithCallback(opts: AsyncOptions): UtsJSONObject {\n return testSyncWithCallback(opts);
\n
}
\n
static async testClassStaticAsync(opts: AsyncOptions): Promise<UtsJSONObject> {\n const res = await testAsync(opts);
\n
return res;
\n
}
\n
testClassSyncWithCallback(opts: AsyncOptions): UtsJSONObject {\n return testSyncWithCallback(opts);
\n
}
\n
async testClassAsync(opts: AsyncOptions): Promise<UtsJSONObject> {\n const res = await testAsync(opts);
\n
return res;
\n
}
\n
}
\n
"
],
"names"
:
[],
"mappings"
:
";;;;;;AAAO,IAAS,GAAG,CAAC,GAAW,EAAN,MAAM,EAAE;IAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,uDAAC,CAAC;;ACAC,WAAf,YAAY;IACf,kBAAA,IAAI,EAAE,MAAM,CAAC;IACb,kBAAA,OAAO,EAAA,WAAuB,CAAC;IAC/B,kBAAA,IAAI,EAAA,WAAuB,CAAC;IAC5B,kBAAA,QAAQ,EAAA,WAAuB,CAAC;CACjC,AAAC;AAIK,IAAM,GAAG,GAAG,GAAG,AAAC;AAMhB,IAAS,QAAQ,CAAC,GAAW,EAAN,MAAM,iBAAE;IACpC,OAAO,CAAC,GAAG,CAAC,UAAU,wDAAC,CAAC;IACxB,IAAI,WAAW,CAAC,CAAC;IACjB,OAAO;QACL,IAAA,GAAG,GAAE,GAAC,MAAM,EAAE,GAAG,CAAC,GAAC;KACpB,CAAC;;AAKG,IAAS,aAAa,GAAG;IAC9B,IAAM,GAAG,cAAE,MAAM,IAAK,eAAE,AAAC;IACzB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,wDAAC,CAAC;;AAMf,IAAS,oBAAoB,CAAC,IAAkB,EAAZ,YAAY,iBAAE;IACvD,IAAI,IAAI,CAAC,IAAI,IAAI,SAAS,EACxB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SAExB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEpB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC1B,OAAO;QAAE,IAAA,IAAI,GAAE,sBAAsB;KAAE,CAAC;;AAMnC,YAAe,SAAS,CAAC,IAAkB,EAAZ,YAAY,uEAAE;IAClD,IAAI,IAAI,CAAC,IAAI,IAAI,SAAS,EACxB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SAExB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEpB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC1B,aAAO;QAAE,IAAA,IAAI,GAAE,WAAW;KAAE,CAAC;;AAGZ,WAAd,WAAW;IACd,kBAAA,IAAI,EAAE,MAAM,CAAC;IACb,kBAAA,QAAQ,EAAA,WAAuB,CAAC;CACjC,AAAC;AAEK,WAAM,IAAI;IACf,SAAA,EAAE,EAAE,MAAM,CAAC;IACX,SAAA,IAAI,EAAE,MAAM,CAAC;IAEb,YAAY,EAAU,EAAN,MAAM,EAAE,OAAoB,EAAX,WAAW,CAAE;QAC5C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;;IASvC,SAAA,yBAAyB,CAAC,IAAkB,EAAZ,YAAY,GAAG,aAAa,CAAC;QAC3D,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;;IAEpC,iBAAM,cAAc,CAAC,IAAkB,EAAZ,YAAY,GAAG,QAAO,CAAC,aAAa,8CAAE;QAC/D,IAAM,GAAG,GAAG,AAAM,SAAS,CAAC,IAAI,CAAC,QAAA,AAAC;QAClC,aAAO,GAAG,CAAC;;;QAlBb,IAAO,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;QAM7B,IAAO,+BAA+B,CAAC,IAAkB,EAAZ,YAAY,GAAG,aAAa,CAAC;YACxE,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;;QAEpC,YAAa,oBAAoB,CAAC,IAAkB,EAAZ,YAAY,GAAG,QAAO,CAAC,aAAa,8CAAE;YAC5E,IAAM,GAAG,GAAG,AAAM,SAAS,CAAC,IAAI,CAAC,QAAA,AAAC;YAClC,aAAO,GAAG,CAAC;;;CASd"
}
\ No newline at end of file
{"version":3,"sources":["\\\\?\\D:\\Do\\Source\\hello-uts\\uni_modules\\uts-advance\\app-android\\index.uts"],"sourcesContent":["import { log } from \"./utils.uts\";\n\r\n\r\ntype TimerOptions = {\r\n start: (res: string) => void;\n work: (res: string) => void;\n};\r\n\r\n\r\n\nexport function doTimerTask(opts:TimerOptions) {\r\n\topts.start('doTimerTask start');\r\n\tsetTimeout(function() {\r\n\t\topts.work(\"doTimerTask work\");\r\n\t}, 2000);\n \n return { name: \"doTimerTask\" };\n}\r\n\r\n\r\nexport function doIntervalTask(opts:TimerOptions) {\r\n\t\r\n\tvar taskRet = setInterval(function() {\r\n\t\topts.work(\"doIntervalTask work\");\r\n\t}, 2000);\r\n\topts.start('doIntervalTask start');\r\n \n return { name: \"doIntervalTask\",taskId:taskRet};\n}\r\n\r\n\n\r\n"],"names":[],"mappings":";;;;;;AAGoB,WAAf,YAAY;IACf,kBAAA,KAAK,EAAA,WAAuB,CAAC;IAC7B,kBAAA,IAAI,EAAA,WAAuB,CAAC;CAC7B,AAAC;AAIK,IAAS,WAAW,CAAC,IAAiB,EAAZ,YAAY,iBAAE;IAC9C,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAChC,UAAU,CAAC,MAAW;QACrB,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;;IAC9B,EAAE,IAAI,CAAC,CAAC;IAER,OAAO;QAAE,IAAA,IAAI,GAAE,aAAa;KAAE,CAAC;;AAI1B,IAAS,cAAc,CAAC,IAAiB,EAAZ,YAAY,iBAAE;IAEjD,IAAI,OAAO,GAAG,WAAW,CAAC,MAAW;QACpC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;;IACjC,EAAE,IAAI,CAAC,AAAC;IACT,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAElC,OAAO;QAAE,IAAA,IAAI,GAAE,gBAAgB;QAAC,IAAA,MAAM,GAAC,OAAO;KAAC,CAAC"}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录