@mifa/native.js
v1.1.18
Published
iOS and Android application SDK.
Readme
Native.js
iOS and Android application SDK.
Install
npm i native.jsUsage
Used in umd mode
<html>
<head>
<title>IOS Android SDK</title>
<script src="https://static.mifaqianbao.com/sdk/native.js/1.0.0/dist/index.js"></script>
</head>
<body>
<script>
window.onload = function() {
window.Native.Request({
url: 'http://baidu.com'
}).then(console.log);
}
</script>
</body>
</html>Used in require import mode
import { Request } from 'native.js';
Request({
url: 'http://baidu.com'
}).then(console.log);API
Request
原生AJAX请求库,支持跨域
import { Request } from 'native.js';
// @return <Promise>
Request(options);
// window.Native.Request(options)- @options
url-String请求地址data-Object/String/ArrayBuffer请求的参数header-Object设置请求的 header,header 中不能设置 Referermethod-String(需大写)有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT。默认GETdataType-String如果设为json,会尝试对返回的数据做一次JSON.parse默认jsonresponseType-String设置响应的数据类型。合法值:textarraybuffer默认text
- @return
Promise
