/*
* 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.
*/
The definitions of some interfaces implemented in jsapi/workers/worker.cpp are released under Mozilla license.
The definitions and functions of these interfaces are consistent with the standard interfaces under mozila license,
but the implementation of specific functions is independent and self-developed.
All interfaces are described in d.ts, the following is the interface written in d.ts under to Mozilla license
export interface WorkerOptions {
type?: "classic" | "module";
name?: string;
shared?: boolean;
}
export interface Event {
readonly type: string;
readonly timeStamp: number;
}
interface ErrorEvent extends Event {
readonly message: string;
readonly filename: string;
readonly lineno: number;
readonly colno: number;
readonly error: Object;
}
declare interface MessageEvent<T = Object> extends Event {
readonly data: T;
}
export interface PostMessageOptions {
transfer?: Object[];
}
export interface EventListener {
(evt: Event): void | Promise<void>;
}
type MessageType = "message" | "messageerror";
declare interface EventTarget {
addEventListener(
type: string,
listener: EventListener
): void;
dispatchEvent(event: Event): boolean;
removeEventListener(
type: string,
callback?: EventListener
): void;
removeAllListener(): void;
}
declare interface WorkerGlobalScope extends EventTarget {
readonly name: string;
onerror?: (ev: ErrorEvent) => void;
readonly self: WorkerGlobalScope & typeof globalThis;
}
declare interface DedicatedWorkerGlobalScope extends WorkerGlobalScope {
onmessage?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;
onmessageerror?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;
close(): void;
postMessage(messageObject: Object, transfer: Transferable[]): void;
postMessage(messageObject: Object, options?: PostMessageOptions): void;
}
declare namespace worker {
class Worker extends EventTarget {
constructor(scriptURL: string, options?: WorkerOptions);
onexit?: (code: number) => void;
onerror?: (err: ErrorEvent) => void;
onmessage?: (event: MessageEvent) => void;
onmessageerror?: (event: MessageEvent) => void;
postMessage(message: Object, transfer: ArrayBuffer[]): void;
postMessage(message: Object, options?: PostMessageOptions): void;
terminate(): void;
}
const parentPort: DedicatedWorkerGlobalScope;
}
没有合适的资源?快使用搜索试试~ 我知道了~
ets-utils组件,用于存放基础类库JSAPI,比如url、uri等
共210个文件
cpp:87个
h:60个
gn:25个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 173 浏览量
2023-12-07
09:53:00
上传
评论
收藏 427KB ZIP 举报
温馨提示
用于存放基础类库JSAPI,比如url、uri等。ets_utils组件共提供四个子模块,分别是:js_api_module子模块、js_util_module子模块、js_sys_module子模块和js_concurrent_module子模块,
资源推荐
资源详情
资源评论
收起资源包目录
ets-utils组件,用于存放基础类库JSAPI,比如url、uri等 (210个子文件)
test_xml.cpp 87KB
worker.cpp 81KB
test_napi.cpp 78KB
js_url.cpp 76KB
test_util.cpp 73KB
native_module_util.cpp 70KB
js_xml.cpp 63KB
native_module_buffer.cpp 42KB
native_module_url.cpp 37KB
task_manager.cpp 36KB
test_napi.cpp 35KB
test_napi.cpp 32KB
console.cpp 30KB
test_console.cpp 29KB
native_module_process.cpp 29KB
js_process.cpp 26KB
js_convertxml.cpp 26KB
js_base64.cpp 25KB
test_convertxml.cpp 24KB
native_module_xml.cpp 22KB
test_process.cpp 21KB
test_worker.cpp 20KB
test_taskpool.cpp 20KB
js_childprocess.cpp 18KB
process_helper.cpp 18KB
js_types.cpp 17KB
js_uri.cpp 17KB
converter.cpp 16KB
taskpool.cpp 16KB
worker.cpp 16KB
test_concurrent.cpp 15KB
js_buffer.cpp 13KB
native_module_uri.cpp 12KB
test_timer.cpp 12KB
timer.cpp 9KB
task.cpp 9KB
native_module_dfx.cpp 8KB
napi_helper.cpp 8KB
js_textdecoder.cpp 8KB
js_uuid.cpp 7KB
native_module_convertxml.cpp 5KB
js_textencoder.cpp 3KB
task_group.cpp 3KB
js_blob.cpp 3KB
util_helper.cpp 3KB
message_queue.cpp 2KB
native_module_lightweightmap.cpp 2KB
native_module_lightweightset.cpp 2KB
native_module_plainarray.cpp 2KB
native_module_linkedlist.cpp 2KB
native_module_arraylist.cpp 2KB
native_module_treeset.cpp 2KB
native_module_treemap.cpp 2KB
native_module_hashset.cpp 2KB
native_module_hashmap.cpp 2KB
native_module_struct.cpp 2KB
native_module_vector.cpp 2KB
native_module_deque.cpp 2KB
native_module_stack.cpp 2KB
native_module_queue.cpp 2KB
native_module_list.cpp 2KB
util_helper.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
test_ark.cpp 2KB
task_runner.cpp 1KB
worker_runner.cpp 1KB
process_helper.cpp 1KB
qos_helper.cpp 1KB
native_module_worker.cpp 1KB
thread.cpp 1KB
thread.cpp 1KB
native_module_taskpool.cpp 1KB
jni_helper.cpp 1KB
task_queue.cpp 1KB
qos_helper.cpp 858B
process_helper.cpp 770B
jni_helper.cpp 745B
BUILD.gn 5KB
BUILD.gn 5KB
BUILD.gn 4KB
BUILD.gn 4KB
BUILD.gn 4KB
BUILD.gn 4KB
BUILD.gn 4KB
BUILD.gn 4KB
BUILD.gn 3KB
BUILD.gn 3KB
BUILD.gn 2KB
BUILD.gn 2KB
BUILD.gn 2KB
共 210 条
- 1
- 2
- 3
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6705
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功