Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
01597c9c
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
01597c9c
编写于
10月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5881 Add interface exception information for worker
Merge pull request !5881 from hyq5234/master
上级
f6716b41
bc656b59
变更
26
展开全部
隐藏空白更改
内联
并排
Showing
26 changed file
with
2809 addition
and
0 deletion
+2809
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker.js
...lib_standard/src/main/js/MainAbility/workers/newworker.js
+55
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_002.js
...standard/src/main/js/MainAbility/workers/newworker_002.js
+23
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_003.js
...standard/src/main/js/MainAbility/workers/newworker_003.js
+22
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_004.js
...standard/src/main/js/MainAbility/workers/newworker_004.js
+23
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_005.js
...standard/src/main/js/MainAbility/workers/newworker_005.js
+21
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_006.js
...standard/src/main/js/MainAbility/workers/newworker_006.js
+21
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_007.js
...standard/src/main/js/MainAbility/workers/newworker_007.js
+21
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_008.js
...standard/src/main/js/MainAbility/workers/newworker_008.js
+21
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_009.js
...standard/src/main/js/MainAbility/workers/newworker_009.js
+45
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0091.js
...tandard/src/main/js/MainAbility/workers/newworker_0091.js
+21
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_010.js
...standard/src/main/js/MainAbility/workers/newworker_010.js
+50
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0101.js
...tandard/src/main/js/MainAbility/workers/newworker_0101.js
+22
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_011.js
...standard/src/main/js/MainAbility/workers/newworker_011.js
+50
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0111.js
...tandard/src/main/js/MainAbility/workers/newworker_0111.js
+22
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_012.js
...standard/src/main/js/MainAbility/workers/newworker_012.js
+50
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0121.js
...tandard/src/main/js/MainAbility/workers/newworker_0121.js
+36
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0122.js
...tandard/src/main/js/MainAbility/workers/newworker_0122.js
+25
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_013.js
...standard/src/main/js/MainAbility/workers/newworker_013.js
+50
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0131.js
...tandard/src/main/js/MainAbility/workers/newworker_0131.js
+22
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_014.js
...standard/src/main/js/MainAbility/workers/newworker_014.js
+50
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0141.js
...tandard/src/main/js/MainAbility/workers/newworker_0141.js
+23
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_015.js
...standard/src/main/js/MainAbility/workers/newworker_015.js
+46
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0151.js
...tandard/src/main/js/MainAbility/workers/newworker_0151.js
+45
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0152.js
...tandard/src/main/js/MainAbility/workers/newworker_0152.js
+22
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/test/List.test.js
...s_utils/worker_lib_standard/src/main/js/test/List.test.js
+2
-0
commonlibrary/ets_utils/worker_lib_standard/src/main/js/test/ThreadWorker.test.js
...worker_lib_standard/src/main/js/test/ThreadWorker.test.js
+2021
-0
未找到文件。
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
workerPort
;
console
.
info
(
"
worker:: new version
"
)
parentPort
.
onclose
=
function
()
{
console
.
info
(
"
worker::worker.js onclose
"
);
}
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
console
.
info
(
"
worker:: worker thread worker data is
"
+
data
.
data
);
switch
(
data
.
type
)
{
case
"
normal
"
:
console
.
info
(
"
worker:: worker thread receive data
"
+
data
.
data
);
parentPort
.
postMessage
(
data
);
console
.
info
(
"
worker:: worker thread post back
"
);
break
;
case
"
error
"
:
throw
new
Error
(
"
123
"
);
case
"
buffer
"
:
console
.
info
(
"
worker:: worker.js receive buffer length is
"
+
data
.
data
.
byteLength
);
parentPort
.
postMessage
(
data
,
[
data
.
data
]);
console
.
info
(
"
worker:: worker.js post buffer length is
"
+
data
.
data
.
byteLength
);
break
;
default
:
console
.
info
(
"
worker:: worker.js receive unknow type
"
);
break
}
}
// Deserialization error
parentPort
.
onmessageerror
=
function
()
{
console
.
info
(
"
worker:: worker.js onmessageerror
"
);
}
// js execution error
parentPort
.
onerror
=
function
(
data
)
{
console
.
info
(
"
worker:: worker.js onerror
"
+
data
.
lineno
+
"
, msg =
"
+
data
.
message
+
"
, filename =
"
+
data
.
filename
+
"
, colno =
"
+
data
.
colno
);
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_002.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
console
.
log
(
"
worker:: worker receive data
"
+
e
.
data
);
let
data
=
e
.
data
+
"
worker
"
;
parentPort
.
postMessage
(
data
)
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_003.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
*
2
+
1
parentPort
.
postMessage
(
data
)
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_004.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
data
.
message
=
"
hello world
"
+
"
worker
"
parentPort
.
postMessage
(
data
)
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_005.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
parentPort
.
postMessage
(
name
)
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_006.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
parentPort
.
postMessage
(
"
hello world
"
)
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_007.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
throw
new
Error
(
123
)
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_008.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
parentPort
.
close
()
}
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_009.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0091.js
"
);
console
.
log
(
"
worker:: workerxx
"
);
ss
.
onexit
=
function
()
{
flag
=
true
;
}
parentPort
.
postMessage
(
ss
!=
null
);
break
;
case
"
wait
"
:
if
(
flag
)
{
parentPort
.
postMessage
(
"
terminate
"
);
}
break
;
case
"
terminate
"
:
flag
=
false
;
ss
.
terminate
();
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0091.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
console
.
log
(
"
worker:: onmessage
"
);
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_010.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0101.js
"
);
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
flag
=
true
;
}
ss
.
onexit
=
function
()
{
backValue
=
"
terminate
"
;
flag
=
true
;
}
ss
.
postMessage
(
data
.
value
);
break
;
case
"
wait
"
:
if
(
flag
)
{
parentPort
.
postMessage
(
backValue
);
}
break
;
case
"
terminate
"
:
flag
=
false
;
ss
.
terminate
();
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0101.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
// 12
parentPort
.
postMessage
(
data
*
2
+
1
);
// 25
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_011.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0111.js
"
);
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
flag
=
true
;
}
ss
.
onexit
=
function
(
code
)
{
backValue
=
"
terminate
"
;
flag
=
true
;
}
ss
.
postMessage
(
data
.
value
);
break
;
case
"
wait
"
:
if
(
flag
)
{
parentPort
.
postMessage
(
backValue
);
}
break
;
case
"
terminate
"
:
flag
=
false
;
ss
.
terminate
();
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0111.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
console
.
log
(
"
worker:: onmessage
"
)
parentPort
.
postMessage
(
"
terminate
"
);
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_012.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0121.js
"
);
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
flag
=
true
;
}
ss
.
onexit
=
function
()
{
backValue
=
"
terminate
"
;
flag
=
true
;
}
ss
.
postMessage
({
type
:
"
new
"
});
break
;
case
"
wait
"
:
if
(
flag
)
{
parentPort
.
postMessage
(
backValue
);
}
break
;
case
"
terminate
"
:
flag
=
false
;
ss
.
terminate
();
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0121.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0122.js
"
);
ss
.
terminate
();
ss
.
onexit
=
function
()
{
parentPort
.
postMessage
(
ss
!=
null
);
}
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0122.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
console
.
info
(
"
worker:: thrid worker onmessage
"
)
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_013.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
var
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0131.js
"
);
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
flag
=
true
;
}
ss
.
onexit
=
function
()
{
backValue
=
"
terminate
"
;
flag
=
true
;
}
ss
.
postMessage
(
data
.
value
);
break
;
case
"
wait
"
:
if
(
flag
)
{
parentPort
.
postMessage
(
backValue
);
}
break
;
case
"
terminate
"
:
flag
=
false
;
ss
.
terminate
();
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0131.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
// hello world
parentPort
.
postMessage
(
data
+
"
worker
"
);
// hello world worker
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_014.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0141.js
"
);
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
flag
=
true
;
}
ss
.
onexit
=
function
()
{
backValue
=
"
terminate
"
;
flag
=
true
;
}
ss
.
postMessage
(
data
.
value
);
break
;
case
"
wait
"
:
if
(
flag
)
{
parentPort
.
postMessage
(
backValue
);
}
break
;
case
"
terminate
"
:
flag
=
false
;
ss
.
terminate
();
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0141.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
data
[
0
]
+=
1
parentPort
.
postMessage
(
data
);
// [2, 2]
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_015.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
var
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0151.js
"
);
ss
.
onexit
=
function
()
{
parentPort
.
postMessage
(
backValue
);
// 16
}
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
// 16
flag
=
true
;
}
ss
.
postMessage
({
type
:
"
new
"
,
value
:
data
.
value
+
1
});
// 11
break
;
case
"
wait
"
:
ss
.
postMessage
({
type
:
"
wait
"
});
if
(
flag
)
{
ss
.
terminate
();
}
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0151.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
var
ss
=
undefined
;
var
backValue
=
undefined
;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
ThreadWorker
(
"
workers/newworker_0152.js
"
);
ss
.
onexit
=
function
()
{
parentPort
.
postMessage
(
backValue
);
// 16
}
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
flag
=
true
;
}
ss
.
postMessage
(
data
.
value
+
2
);
// 13
break
;
case
"
wait
"
:
if
(
flag
)
{
ss
.
terminate
();
}
break
;
default
:
break
;
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/MainAbility/workers/newworker_0152.js
0 → 100644
浏览文件 @
01597c9c
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
worker
from
"
@ohos.worker
"
const
parentPort
=
worker
.
workerPort
;
parentPort
.
onmessage
=
function
(
e
)
{
let
data
=
e
.
data
;
parentPort
.
postMessage
(
data
+
3
);
// 16
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/test/List.test.js
浏览文件 @
01597c9c
...
@@ -13,7 +13,9 @@
...
@@ -13,7 +13,9 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
workerTest
from
'
./Worker.test.js
'
import
workerTest
from
'
./Worker.test.js
'
import
threadWorkerTest
from
'
./ThreadWorker.test.js
'
export
default
function
testsuite
()
{
export
default
function
testsuite
()
{
workerTest
()
workerTest
()
threadWorkerTest
()
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/src/main/js/test/ThreadWorker.test.js
0 → 100644
浏览文件 @
01597c9c
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录