代码拉取完成,页面将自动刷新
The network stack component is an adaptation layer framework for developers to develop network protocol stacks such as HTTP, socket and websocket for OpenHarmony applications. At present, it mainly consists of the following two parts:
NAPI based JS adaptation layer on mini system and small system.
JSI based JS adaptation layer on standard system.
The source code of the network stack component is stored in /foundation/communication/netstack. The directory structure is as follows:
/foundation/communication/netstack
├── frameworks # Framework code
│ ├── js # JS adaptation
│ ├── builtin # JSI based JS adaptation layer on mini system and small system
│ └── napi # NAPI based JS adaptation layer on standard system
├── interfaces # APIs exposed externally
│ └── kits # OpenHarmony SDK API, including Java, JS and native. At present, there is only JS
│ └── js # JS API
├── utils # Common tools
│ └── log # Log tool
export interface FetchResponse {
/**
* Server status code.
* @since 3
*/
code: number;
/**
* Data returned by the success function.
* @since 3
*/
data: string | object;
/**
* All headers in the response from the server.
* @since 3
*/
headers: Object;
}
/**
* @Syscap SysCap.ACE.UIEngine
*/
export default class Fetch {
/**
* Obtains data through the network.
* @param options
*/
static fetch(options: {
/**
* Resource URL.
* @since 3
*/
url: string;
/**
* Request parameter, which can be of the string type or a JSON object.
* @since 3
*/
data?: string | object;
/**
* Request header, which accommodates all attributes of the request.
* @since 3
*/
header?: Object;
/**
* Request methods available: OPTIONS, GET, HEAD, POST, PUT, DELETE and TRACE. The default value is GET.
* @since 3
*/
method?: string;
/**
* The return type can be text, or JSON. By default, the return type is determined based on Content-Type in the header returned by the server.
* @since 3
*/
responseType?: string;
/**
* Called when the network data is obtained successfully.
* @since 3
*/
success?: (data: FetchResponse) => void;
/**
* Called when the network data fails to be obtained.
* @since 3
*/
fail?: (data: any, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。