提交 0090392e 编写于 作者: fxy060608's avatar fxy060608

build runtime

上级 fdb1cca8
......@@ -1281,6 +1281,12 @@ var serviceContext = (function () {
isConnected: networkType !== 'none',
networkType
});
});
plus.globalEvent.addEventListener('KeyboardHeightChange', function (event) {
publish('onKeyboardHeightChange', {
height: event.height
});
});
}
......@@ -1506,7 +1512,8 @@ var serviceContext = (function () {
];
const keyboard = [
'hideKeyboard'
'hideKeyboard',
'onKeyboardHeightChange'
];
const ui = [
......@@ -1819,7 +1826,7 @@ var serviceContext = (function () {
};
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -1852,8 +1859,8 @@ var serviceContext = (function () {
function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......@@ -5856,9 +5863,6 @@ var serviceContext = (function () {
return createDownloadTaskById(++downloadTaskId, args)
}
const USER_AGENT =
'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 MicroMessenger/6.5.1 NetType/WIFI Language/zh_CN';
let requestTaskId = 0;
const requestTasks = {};
......@@ -5891,9 +5895,7 @@ var serviceContext = (function () {
if (!hasContentType && method === 'POST') {
headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
if (__uniConfig.crossDomain === true) {
headers['User-Agent'] = USER_AGENT;
}
const timeout = __uniConfig.networkTimeout.request;
if (timeout) {
abortTimeout = setTimeout(() => {
......@@ -5908,7 +5910,7 @@ var serviceContext = (function () {
}
const options = {
method,
url,
url: url.trim(),
// weex 官方文档有误,headers 类型实际 object,用 string 类型会无响应
headers,
type: 'text',
......@@ -8327,6 +8329,22 @@ var serviceContext = (function () {
createAnimation: createAnimation
});
const callbacks$7 = [];
onMethod('onKeyboardHeightChange', res => {
callbacks$7.forEach(callbackId => {
invoke(callbackId, res);
});
});
function onKeyboardHeightChange (callbackId) {
callbacks$7.push(callbackId);
}
var require_context_module_1_17 = /*#__PURE__*/Object.freeze({
onKeyboardHeightChange: onKeyboardHeightChange
});
function pageScrollTo$1 (args) {
const pages = getCurrentPages();
if (pages.length) {
......@@ -8335,7 +8353,7 @@ var serviceContext = (function () {
return {}
}
var require_context_module_1_17 = /*#__PURE__*/Object.freeze({
var require_context_module_1_18 = /*#__PURE__*/Object.freeze({
pageScrollTo: pageScrollTo$1
});
......@@ -8359,29 +8377,29 @@ var serviceContext = (function () {
const hideTabBarRedDot$1 = removeTabBarBadge$1;
var require_context_module_1_18 = /*#__PURE__*/Object.freeze({
var require_context_module_1_19 = /*#__PURE__*/Object.freeze({
removeTabBarBadge: removeTabBarBadge$1,
showTabBarRedDot: showTabBarRedDot$1,
hideTabBarRedDot: hideTabBarRedDot$1
});
const callbacks$7 = [];
const callbacks$8 = [];
onMethod('onViewDidResize', res => {
callbacks$7.forEach(callbackId => {
callbacks$8.forEach(callbackId => {
invoke(callbackId, res);
});
});
function onWindowResize (callbackId) {
callbacks$7.push(callbackId);
callbacks$8.push(callbackId);
}
function offWindowResize (callbackId) {
// 此处和微信平台一致查询不到去掉最后一个
callbacks$7.splice(callbacks$7.indexOf(callbackId), 1);
callbacks$8.splice(callbacks$8.indexOf(callbackId), 1);
}
var require_context_module_1_19 = /*#__PURE__*/Object.freeze({
var require_context_module_1_20 = /*#__PURE__*/Object.freeze({
onWindowResize: onWindowResize,
offWindowResize: offWindowResize
});
......@@ -8408,9 +8426,10 @@ var serviceContext = (function () {
'./network/upload-file.js': require_context_module_1_14,
'./storage/storage.js': require_context_module_1_15,
'./ui/create-animation.js': require_context_module_1_16,
'./ui/page-scroll-to.js': require_context_module_1_17,
'./ui/tab-bar.js': require_context_module_1_18,
'./ui/window.js': require_context_module_1_19,
'./ui/keyboard.js': require_context_module_1_17,
'./ui/page-scroll-to.js': require_context_module_1_18,
'./ui/tab-bar.js': require_context_module_1_19,
'./ui/window.js': require_context_module_1_20,
};
var req = function req(key) {
......
......@@ -122,7 +122,7 @@ function invokeApi (method, api, options, ...params) {
}
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -149,8 +149,8 @@ function handlePromise (promise) {
function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......@@ -695,6 +695,9 @@ function initUni (uni, nvue, plus, BroadcastChannel) {
if (typeof Proxy !== 'undefined') {
return new Proxy({}, {
get (target, name) {
if (target[name]) {
return target[name]
}
if (apis[name]) {
return apis[name]
}
......@@ -705,6 +708,9 @@ function initUni (uni, nvue, plus, BroadcastChannel) {
return
}
return promisify(name, uni[name])
},
set (target, name, value) {
target[name] = value;
}
})
}
......
......@@ -231,7 +231,7 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......
{
"name": "@dcloudio/uni-app-plus",
"version": "0.0.251",
"version": "0.0.252",
"description": "uni-app app-plus",
"main": "dist/index.js",
"scripts": {
......
......@@ -231,7 +231,7 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......
{
"name": "@dcloudio/uni-mp-alipay",
"version": "0.0.825",
"version": "0.0.826",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"scripts": {
......
......@@ -231,7 +231,7 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......@@ -426,6 +426,16 @@ function createTodoMethod (contextName, methodName) {
console.error(`百度小程序 ${contextName}暂不支持${methodName}`);
}
}
function _handleEnvInfo (result) {
result.miniProgram = {
appId: result.appKey
};
result.plugin = {
version: result.sdkVersion
};
}
// 需要做转换的 API 列表
const protocols = {
request: {
......@@ -479,6 +489,10 @@ const protocols = {
},
showShareMenu: {
name: 'openShare'
},
getAccountInfoSync: {
name: 'getEnvInfoSync',
returnValue: _handleEnvInfo
}
};
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.855",
"version": "0.0.856",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
......
......@@ -231,7 +231,7 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......@@ -402,23 +402,11 @@ const todos = [
'canIUse',
'onMemoryWarning',
'onNetworkStatusChange',
'onAccelerometerChange',
'startAccelerometer',
'stopAccelerometer',
'onCompassChange',
'startCompass',
'scanCode',
'startBeaconDiscovery',
'stopBeaconDiscovery',
'getBeacons',
'onBeaconUpdate',
'onBeaconServiceChange',
'setScreenBrightness',
'getScreenBrightness',
'setKeepScreenOn',
'onUserCaptureScreen',
'vibrateLong',
'vibrateShort',
'addPhoneContact',
'getHCEState',
'startHCE',
......@@ -449,13 +437,25 @@ const todos = [
'checkIsSupportSoterAuthentication',
'startSoterAuthentication',
'checkIsSoterEnrolledInDevice',
'createWorker',
'reportMonitor',
'getLogManager',
'onUserCaptureScreen',
'reportAnalytics'
];
const canIUses = [];
const canIUses = [
'scanCode',
'startAccelerometer',
'stopAccelerometer',
'onAccelerometerChange',
'startCompass',
'onCompassChange',
'setScreenBrightness',
'getScreenBrightness',
'setKeepScreenOn',
'onUserCaptureScreen',
'vibrateLong',
'vibrateShort',
'createWorker'
];
const CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
......
{
"name": "@dcloudio/uni-mp-qq",
"version": "0.0.109",
"version": "0.0.110",
"description": "uni-app mp-qq",
"main": "dist/index.js",
"scripts": {
......
......@@ -231,7 +231,7 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.349",
"version": "0.0.350",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"scripts": {
......
......@@ -231,7 +231,7 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.971",
"version": "0.0.972",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
......
......@@ -8,7 +8,7 @@ import {
} from './interceptor'
const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
const CONTEXT_API_RE = /^create|Manager$/
......@@ -41,8 +41,8 @@ function handlePromise (promise) {
export function shouldPromise (name) {
if (
isContextApi(name) ||
isSyncApi(name) ||
isCallbackApi(name)
isSyncApi(name) ||
isCallbackApi(name)
) {
return false
}
......
......@@ -106,7 +106,7 @@ const protocols = {
name: 'openShare'
},
getAccountInfoSync: {
name: "getEnvInfoSync",
name: 'getEnvInfoSync',
returnValue: _handleEnvInfo
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册