Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
菜鸟程序猿_c
uni-app
提交
84969ca6
U
uni-app
项目概览
菜鸟程序猿_c
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
84969ca6
编写于
9月 15, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: type cast => generics
上级
de71b7e4
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
302 addition
and
264 deletion
+302
-264
packages/uni-api/src/service/context/createMapContext.ts
packages/uni-api/src/service/context/createMapContext.ts
+1
-1
packages/uni-api/src/service/ui/createSelectorQuery.ts
packages/uni-api/src/service/ui/createSelectorQuery.ts
+9
-9
packages/uni-api/src/service/ui/locale.ts
packages/uni-api/src/service/ui/locale.ts
+4
-1
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+46
-46
packages/uni-app-plus/src/service/api/ad/fullScreenVideoAd.ts
...ages/uni-app-plus/src/service/api/ad/fullScreenVideoAd.ts
+2
-3
packages/uni-app-plus/src/service/api/ad/interactiveAd.ts
packages/uni-app-plus/src/service/api/ad/interactiveAd.ts
+2
-3
packages/uni-app-plus/src/service/api/ad/interstitialAd.ts
packages/uni-app-plus/src/service/api/ad/interstitialAd.ts
+2
-3
packages/uni-app-plus/src/service/api/ad/rewardedVideoAd.ts
packages/uni-app-plus/src/service/api/ad/rewardedVideoAd.ts
+2
-3
packages/uni-app-plus/src/service/api/device/accelerometer.ts
...ages/uni-app-plus/src/service/api/device/accelerometer.ts
+12
-12
packages/uni-app-plus/src/service/api/device/compass.ts
packages/uni-app-plus/src/service/api/device/compass.ts
+16
-12
packages/uni-app-plus/src/service/api/file/getFileInfo.ts
packages/uni-app-plus/src/service/api/file/getFileInfo.ts
+1
-1
packages/uni-app-plus/src/service/api/file/getSavedFileInfo.ts
...ges/uni-app-plus/src/service/api/file/getSavedFileInfo.ts
+1
-1
packages/uni-app-plus/src/service/api/file/getSavedFileList.ts
...ges/uni-app-plus/src/service/api/file/getSavedFileList.ts
+6
-5
packages/uni-app-plus/src/service/api/file/removeSavedFile.ts
...ages/uni-app-plus/src/service/api/file/removeSavedFile.ts
+1
-1
packages/uni-app-plus/src/service/api/file/saveFile.ts
packages/uni-app-plus/src/service/api/file/saveFile.ts
+1
-1
packages/uni-app-plus/src/service/api/location/chooseLocation.ts
...s/uni-app-plus/src/service/api/location/chooseLocation.ts
+1
-1
packages/uni-app-plus/src/service/api/location/getLocation.ts
...ages/uni-app-plus/src/service/api/location/getLocation.ts
+1
-1
packages/uni-app-plus/src/service/api/location/locationChange.ts
...s/uni-app-plus/src/service/api/location/locationChange.ts
+23
-17
packages/uni-app-plus/src/service/api/location/openLocation.ts
...ges/uni-app-plus/src/service/api/location/openLocation.ts
+1
-1
packages/uni-app-plus/src/service/api/media/getVideoInfo.ts
packages/uni-app-plus/src/service/api/media/getVideoInfo.ts
+1
-1
packages/uni-app-plus/src/service/api/media/previewImage.ts
packages/uni-app-plus/src/service/api/media/previewImage.ts
+1
-1
packages/uni-app-plus/src/service/api/storage/storage.ts
packages/uni-app-plus/src/service/api/storage/storage.ts
+23
-19
packages/uni-h5-vite/lib/api.json
packages/uni-h5-vite/lib/api.json
+1
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+1
-1
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+5
-5
packages/uni-h5/src/service/api/device/accelerometer.ts
packages/uni-h5/src/service/api/device/accelerometer.ts
+12
-12
packages/uni-h5/src/service/api/device/compass.ts
packages/uni-h5/src/service/api/device/compass.ts
+16
-12
packages/uni-h5/src/service/api/location/chooseLocation/index.ts
...s/uni-h5/src/service/api/location/chooseLocation/index.ts
+1
-1
packages/uni-h5/src/service/api/location/getLocation.ts
packages/uni-h5/src/service/api/location/getLocation.ts
+1
-1
packages/uni-h5/src/service/api/location/locationChange.ts
packages/uni-h5/src/service/api/location/locationChange.ts
+23
-17
packages/uni-h5/src/service/api/location/openLocation/index.ts
...ges/uni-h5/src/service/api/location/openLocation/index.ts
+1
-1
packages/uni-h5/src/service/api/media/getVideoInfo.ts
packages/uni-h5/src/service/api/media/getVideoInfo.ts
+1
-1
packages/uni-h5/src/service/api/media/previewImage/index.ts
packages/uni-h5/src/service/api/media/previewImage/index.ts
+1
-1
packages/uni-h5/src/service/api/network/socket.ts
packages/uni-h5/src/service/api/network/socket.ts
+1
-1
packages/uni-h5/src/service/api/storage/storage.ts
packages/uni-h5/src/service/api/storage/storage.ts
+23
-19
packages/uni-h5/src/service/api/todo/index.ts
packages/uni-h5/src/service/api/todo/index.ts
+4
-4
packages/uni-h5/src/service/api/ui/window.ts
packages/uni-h5/src/service/api/ui/window.ts
+54
-44
未找到文件。
packages/uni-api/src/service/context/createMapContext.ts
浏览文件 @
84969ca6
...
...
@@ -96,7 +96,7 @@ export class MapContext implements UniApp.MapContext {
}
}
export
const
createMapContext
=
<
API_TYPE_CREATE_MAP_CONTEXT
>
defineSyncApi
(
export
const
createMapContext
=
defineSyncApi
<
API_TYPE_CREATE_MAP_CONTEXT
>
(
API_CREATE_MAP_CONTEXT
,
(
id
,
context
)
=>
{
if
(
context
)
{
...
...
packages/uni-api/src/service/ui/createSelectorQuery.ts
浏览文件 @
84969ca6
...
...
@@ -206,12 +206,12 @@ class SelectorQuery implements UniApp.SelectorQuery {
}
}
export
const
createSelectorQuery
=
<
typeof
uni
.
createSelectorQuery
>
(
defineSyncApi
(
'
createSelectorQuery
'
,
(
context
?:
any
)
=>
{
context
=
resolveComponentInstance
(
context
)
if
(
context
&&
!
getPageIdByVm
(
context
))
{
context
=
null
}
return
new
SelectorQuery
(
context
||
getCurrentPageVm
()
!
)
}
)
)
export
const
createSelectorQuery
=
defineSyncApi
<
typeof
uni
.
createSelectorQuery
>
(
'
createSelectorQuery
'
,
(
context
?:
any
)
=>
{
context
=
resolveComponentInstance
(
context
)
if
(
context
&&
!
getPageIdByVm
(
context
))
{
context
=
null
}
return
new
SelectorQuery
(
context
||
getCurrentPageVm
()
!
)
}
)
packages/uni-api/src/service/ui/locale.ts
浏览文件 @
84969ca6
...
...
@@ -18,7 +18,10 @@ export const getLocale = defineSyncApi<typeof uni.getLocale>(
}
)
export
const
onLocaleChange
=
defineOnApi
(
API_ON_LOCALE_CHANGE
,
()
=>
{})
export
const
onLocaleChange
=
defineOnApi
<
typeof
uni
.
onLocaleChange
>
(
API_ON_LOCALE_CHANGE
,
()
=>
{}
)
export
const
setLocale
=
defineSyncApi
<
typeof
uni
.
setLocale
>
(
API_SET_LOCALE
,
...
...
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
84969ca6
...
...
@@ -10872,13 +10872,13 @@ class SelectorQuery {
this._queueCb.push(callback);
}
}
const createSelectorQuery =
(
defineSyncApi('createSelectorQuery', (context) => {
const createSelectorQuery = defineSyncApi('createSelectorQuery', (context) => {
context = resolveComponentInstance(context);
if (context && !getPageIdByVm(context)) {
context = null;
}
return new SelectorQuery(context || getCurrentPageVm());
})
)
;
});
// import { elemInArray } from '../../helpers/protocol'
const API_CREATE_ANIMATION = 'createAnimation';
...
...
@@ -13030,7 +13030,7 @@ function parseGetStorage(type, value) {
}
return data;
}
const getStorageSync = defineSyncApi(API_GET_STORAGE_SYNC, (key
, t
) => {
const getStorageSync = defineSyncApi(API_GET_STORAGE_SYNC, (key) => {
const value = plus.storage.getItem(key);
const typeOrigin = plus.storage.getItem(key + STORAGE_DATA_TYPE) || '';
const type = typeOrigin.toLowerCase();
...
...
@@ -13065,13 +13065,13 @@ const removeStorage = defineAsyncApi(API_REMOVE_STORAGE, ({ key }, { resolve, re
plus.storage.removeItemAsync(key + STORAGE_DATA_TYPE);
plus.storage.removeItemAsync(key, resolve, warpPlusErrorCallback(reject));
}, RemoveStorageProtocol);
const clearStorageSync =
(
defineSyncApi('clearStorageSync', () => {
const clearStorageSync = defineSyncApi('clearStorageSync', () => {
plus.storage.clear();
})
)
;
const clearStorage =
(
defineAsyncApi('clearStorage', (_, { resolve, reject }) => {
});
const clearStorage = defineAsyncApi('clearStorage', (_, { resolve, reject }) => {
plus.storage.clearAsync(resolve, warpPlusErrorCallback(reject));
})
)
;
const getStorageInfoSync =
(
defineSyncApi('getStorageInfoSync', () => {
});
const getStorageInfoSync = defineSyncApi('getStorageInfoSync', () => {
const length = plus.storage.getLength() || 0;
const keys = [];
let currentSize = 0;
...
...
@@ -13091,10 +13091,10 @@ const getStorageInfoSync = (defineSyncApi('getStorageInfoSync', () => {
currentSize: Math.ceil((currentSize * 2) / 1024),
limitSize: Number.MAX_VALUE,
};
})
)
;
const getStorageInfo =
(
defineAsyncApi('getStorageInfo', (_, { resolve }) => {
});
const getStorageInfo = defineAsyncApi('getStorageInfo', (_, { resolve }) => {
resolve(getStorageInfoSync());
})
)
;
});
const getFileInfo$1 = defineAsyncApi(API_GET_FILE_INFO, (options, { resolve, reject }) => {
plus.io.getFileInfo(extend(options, {
...
...
@@ -13144,7 +13144,7 @@ function getSavedFileDir(success, fail) {
}, success, fail);
}, fail);
}
const getSavedFileList =
(
defineAsyncApi(API_GET_SAVED_LIST, (_, { resolve, reject }) => {
const getSavedFileList = defineAsyncApi(API_GET_SAVED_LIST, (_, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
getSavedFileDir((entry) => {
var reader = entry.createReader();
...
...
@@ -13173,7 +13173,7 @@ const getSavedFileList = (defineAsyncApi(API_GET_SAVED_LIST, (_, { resolve, reje
}
}, errorCallback);
}, errorCallback);
})
)
;
});
const getSavedFileInfo = defineAsyncApi(API_GET_SAVED_FILE_INFO, ({ filePath }, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
...
...
@@ -13626,13 +13626,13 @@ const getSystemInfo = defineAsyncApi('getSystemInfo', (_, { resolve }) => {
});
let listener$1 = null;
const onCompassChange =
(
defineOnApi(API_ON_COMPASS, () => {
const onCompassChange = defineOnApi(API_ON_COMPASS, () => {
startCompass();
})
)
;
const offCompassChange =
(
defineOffApi(API_OFF_COMPASS, () => {
});
const offCompassChange = defineOffApi(API_OFF_COMPASS, () => {
stopCompass();
})
)
;
const startCompass =
(
defineAsyncApi(API_START_COMPASS, (_, { resolve, reject }) => {
});
const startCompass = defineAsyncApi(API_START_COMPASS, (_, { resolve, reject }) => {
if (!listener$1) {
listener$1 = plus.orientation.watchOrientation((res) => {
UniServiceJSBridge.invokeOnCallback(API_ON_COMPASS, {
...
...
@@ -13646,14 +13646,14 @@ const startCompass = (defineAsyncApi(API_START_COMPASS, (_, { resolve, reject })
});
}
setTimeout(resolve, DEVICE_FREQUENCY);
})
)
;
const stopCompass =
(
defineAsyncApi(API_STOP_COMPASS, (_, { resolve }) => {
});
const stopCompass = defineAsyncApi(API_STOP_COMPASS, (_, { resolve }) => {
if (listener$1) {
plus.orientation.clearWatch(listener$1);
listener$1 = null;
}
resolve();
})
)
;
});
const vibrateShort = defineAsyncApi(API_VIBRATE_SHORT, (_, { resolve }) => {
plus.device.vibrate(15);
...
...
@@ -13665,13 +13665,13 @@ const vibrateLong = defineAsyncApi(API_VIBRATE_LONG, (_, { resolve }) => {
});
let listener = null;
const onAccelerometerChange =
(
defineOnApi(API_ON_ACCELEROMETER, () => {
const onAccelerometerChange = defineOnApi(API_ON_ACCELEROMETER, () => {
startAccelerometer();
})
)
;
const offAccelerometerChange =
(
defineOffApi(API_OFF_ACCELEROMETER, () => {
});
const offAccelerometerChange = defineOffApi(API_OFF_ACCELEROMETER, () => {
stopAccelerometer();
})
)
;
const startAccelerometer =
(
defineAsyncApi(API_START_ACCELEROMETER, (_, { resolve, reject }) => {
});
const startAccelerometer = defineAsyncApi(API_START_ACCELEROMETER, (_, { resolve, reject }) => {
if (!listener) {
listener = plus.accelerometer.watchAcceleration((res) => {
UniServiceJSBridge.invokeOnCallback(API_ON_ACCELEROMETER, {
...
...
@@ -13687,14 +13687,14 @@ const startAccelerometer = (defineAsyncApi(API_START_ACCELEROMETER, (_, { resolv
});
}
setTimeout(resolve, DEVICE_FREQUENCY);
})
)
;
const stopAccelerometer =
(
defineAsyncApi(API_STOP_ACCELEROMETER, (_, { resolve }) => {
});
const stopAccelerometer = defineAsyncApi(API_STOP_ACCELEROMETER, (_, { resolve }) => {
if (listener) {
plus.accelerometer.clearWatch(listener);
listener = null;
}
resolve();
})
)
;
});
const onBluetoothDeviceFound = defineOnApi(API_ON_BLUETOOTH_DEVICE_FOUND, warpPlusEvent(() => plus.bluetooth.onBluetoothDeviceFound.bind(plus.bluetooth), API_ON_BLUETOOTH_DEVICE_FOUND));
const onBluetoothAdapterStateChange = defineOnApi(API_ON_BLUETOOTH_ADAPTER_STATE_CHANGE, warpPlusEvent(() => plus.bluetooth.onBluetoothAdapterStateChange.bind(plus.bluetooth), API_ON_BLUETOOTH_ADAPTER_STATE_CHANGE));
...
...
@@ -16183,7 +16183,7 @@ let watchId = 0;
/**
* 开始更新定位
*/
const startLocationUpdate =
(
defineAsyncApi(API_START_LOCATION_UPDATE, (_, { resolve, reject }) => {
const startLocationUpdate = defineAsyncApi(API_START_LOCATION_UPDATE, (_, { resolve, reject }) => {
if (plus.geolocation && watchId === 0) {
watchId = plus.geolocation.watchPosition((res) => {
UniServiceJSBridge.invokeOnCallback(API_ON_LOCATION_CHANGE, res.coords);
...
...
@@ -16198,9 +16198,9 @@ const startLocationUpdate = (defineAsyncApi(API_START_LOCATION_UPDATE, (_, { res
UniServiceJSBridge.invokeOnCallback(API_ON_LOCATION_CHANGE_ERROR, 'onLocationChange:fail');
}
resolve();
}, StartLocationUpdateProtocol, StartLocationUpdateOptions)
)
;
const onLocationChange =
(defineOnApi(API_ON_LOCATION_CHANGE, () => { })
);
const stopLocationUpdate =
(
defineAsyncApi(API_STOP_LOCATION_UPDATE, (_, { resolve, reject }) => {
}, StartLocationUpdateProtocol, StartLocationUpdateOptions);
const onLocationChange =
defineOnApi(API_ON_LOCATION_CHANGE, () => { }
);
const stopLocationUpdate = defineAsyncApi(API_STOP_LOCATION_UPDATE, (_, { resolve, reject }) => {
if (watchId) {
plus.geolocation.clearWatch(watchId);
watchId = 0;
...
...
@@ -16209,12 +16209,12 @@ const stopLocationUpdate = (defineAsyncApi(API_STOP_LOCATION_UPDATE, (_, { resol
else {
reject('stopLocationUpdate:fail');
}
})
)
;
const offLocationChange =
(
defineOffApi(API_OFF_LOCATION_CHANGE, () => {
});
const offLocationChange = defineOffApi(API_OFF_LOCATION_CHANGE, () => {
stopLocationUpdate();
})
)
;
const onLocationChangeError =
(defineOnApi(API_ON_LOCATION_CHANGE_ERROR, () => { })
);
const offLocationChangeError =
(defineOnApi(API_OFF_LOCATION_CHANGE_ERROR, () => { })
);
});
const onLocationChangeError =
defineOnApi(API_ON_LOCATION_CHANGE_ERROR, () => { }
);
const offLocationChangeError =
defineOnApi(API_OFF_LOCATION_CHANGE_ERROR, () => { }
);
const showModal = defineAsyncApi(API_SHOW_MODAL, ({ title = '', content = '', showCancel = true, cancelText, cancelColor, confirmText, confirmColor, editable = false, placeholderText = '', } = {}, { resolve }) => {
const buttons = showCancel ? [cancelText, confirmText] : [confirmText];
...
...
@@ -17367,9 +17367,9 @@ class RewardedVideoAd extends AdBase {
this._loadAd();
}
}
const createRewardedVideoAd =
(
defineSyncApi(API_CREATE_REWARDED_VIDEO_AD, (options) => {
const createRewardedVideoAd = defineSyncApi(API_CREATE_REWARDED_VIDEO_AD, (options) => {
return new RewardedVideoAd(options);
}, CreateRewardedVideoAdProtocol, CreateRewardedVideoAdOptions)
)
;
}, CreateRewardedVideoAdProtocol, CreateRewardedVideoAdOptions);
class FullScreenVideoAd extends AdBase {
constructor(options) {
...
...
@@ -17377,9 +17377,9 @@ class FullScreenVideoAd extends AdBase {
this.preload = false;
}
}
const createFullScreenVideoAd =
(
defineSyncApi(API_CREATE_FULL_SCREEN_VIDEO_AD, (options) => {
const createFullScreenVideoAd = defineSyncApi(API_CREATE_FULL_SCREEN_VIDEO_AD, (options) => {
return new FullScreenVideoAd(options);
}, CreateFullScreenVideoAdProtocol, CreateFullScreenVideoAdOptions)
)
;
}, CreateFullScreenVideoAdProtocol, CreateFullScreenVideoAdOptions);
class InterstitialAd extends AdBase {
constructor(options) {
...
...
@@ -17388,9 +17388,9 @@ class InterstitialAd extends AdBase {
this._loadAd();
}
}
const createInterstitialAd =
(
defineSyncApi(API_CREATE_INTERSTITIAL_AD, (options) => {
const createInterstitialAd = defineSyncApi(API_CREATE_INTERSTITIAL_AD, (options) => {
return new InterstitialAd(options);
}, CreateInterstitialAdProtocol, CreateInterstitialAdOptions)
)
;
}, CreateInterstitialAdProtocol, CreateInterstitialAdOptions);
const sdkCache = {};
const sdkQueue = {};
...
...
@@ -17598,9 +17598,9 @@ class InteractiveAd extends AdEventHandler {
return new Error(JSON.stringify(err));
}
}
const createInteractiveAd =
(
defineSyncApi(API_CREATE_INTERACTIVE_AD, (options) => {
const createInteractiveAd = defineSyncApi(API_CREATE_INTERACTIVE_AD, (options) => {
return new InteractiveAd(options);
}, CreateInteractiveAdProtocol, CreateInteractiveAdOptions)
)
;
}, CreateInteractiveAdProtocol, CreateInteractiveAdOptions);
const downgrade = plus.os.name === 'Android' && parseInt(plus.os.version) < 6;
const ANI_SHOW = downgrade ? 'slide-in-right' : 'pop-in';
...
...
packages/uni-app-plus/src/service/api/ad/fullScreenVideoAd.ts
浏览文件 @
84969ca6
...
...
@@ -18,8 +18,8 @@ class FullScreenVideoAd
}
}
export
const
createFullScreenVideoAd
=
<
API_TYPE_CREATE_FULL_SCREEN_VIDEO_AD
>
(
defineSyncApi
(
export
const
createFullScreenVideoAd
=
defineSyncApi
<
API_TYPE_CREATE_FULL_SCREEN_VIDEO_AD
>
(
API_CREATE_FULL_SCREEN_VIDEO_AD
,
(
options
)
=>
{
return
new
FullScreenVideoAd
(
options
)
...
...
@@ -27,4 +27,3 @@ export const createFullScreenVideoAd = <API_TYPE_CREATE_FULL_SCREEN_VIDEO_AD>(
CreateFullScreenVideoAdProtocol
,
CreateFullScreenVideoAdOptions
)
)
packages/uni-app-plus/src/service/api/ad/interactiveAd.ts
浏览文件 @
84969ca6
...
...
@@ -258,8 +258,8 @@ class InteractiveAd
}
}
export
const
createInteractiveAd
=
<
API_TYPE_CREATE_INTERACTIVE_AD
>
(
defineSyncApi
(
export
const
createInteractiveAd
=
defineSyncApi
<
API_TYPE_CREATE_INTERACTIVE_AD
>
(
API_CREATE_INTERACTIVE_AD
,
(
options
)
=>
{
return
new
InteractiveAd
(
options
)
...
...
@@ -267,4 +267,3 @@ export const createInteractiveAd = <API_TYPE_CREATE_INTERACTIVE_AD>(
CreateInteractiveAdProtocol
,
CreateInteractiveAdOptions
)
)
packages/uni-app-plus/src/service/api/ad/interstitialAd.ts
浏览文件 @
84969ca6
...
...
@@ -16,8 +16,8 @@ class InterstitialAd extends AdBase implements UniApp.InterstitialAdContext {
}
}
export
const
createInterstitialAd
=
<
API_TYPE_CREATE_INTERSTITIAL_AD
>
(
defineSyncApi
(
export
const
createInterstitialAd
=
defineSyncApi
<
API_TYPE_CREATE_INTERSTITIAL_AD
>
(
API_CREATE_INTERSTITIAL_AD
,
(
options
)
=>
{
return
new
InterstitialAd
(
options
)
...
...
@@ -25,4 +25,3 @@ export const createInterstitialAd = <API_TYPE_CREATE_INTERSTITIAL_AD>(
CreateInterstitialAdProtocol
,
CreateInterstitialAdOptions
)
)
packages/uni-app-plus/src/service/api/ad/rewardedVideoAd.ts
浏览文件 @
84969ca6
...
...
@@ -16,8 +16,8 @@ class RewardedVideoAd extends AdBase implements UniApp.RewardedVideoAdContext {
}
}
export
const
createRewardedVideoAd
=
<
API_TYPE_CREATE_REWARDED_VIDEO_AD
>
(
defineSyncApi
(
export
const
createRewardedVideoAd
=
defineSyncApi
<
API_TYPE_CREATE_REWARDED_VIDEO_AD
>
(
API_CREATE_REWARDED_VIDEO_AD
,
(
options
)
=>
{
return
new
RewardedVideoAd
(
options
)
...
...
@@ -25,4 +25,3 @@ export const createRewardedVideoAd = <API_TYPE_CREATE_REWARDED_VIDEO_AD>(
CreateRewardedVideoAdProtocol
,
CreateRewardedVideoAdOptions
)
)
packages/uni-app-plus/src/service/api/device/accelerometer.ts
浏览文件 @
84969ca6
...
...
@@ -15,20 +15,19 @@ import { DEVICE_FREQUENCY } from '../constants'
let
listener
:
number
|
null
=
null
export
const
onAccelerometerChange
=
<
API_TYPE_ON_ACCELEROMETER_CHANGE
>
(
defineOnApi
(
API_ON_ACCELEROMETER
,
()
=>
{
export
const
onAccelerometerChange
=
defineOnApi
<
API_TYPE_ON_ACCELEROMETER_CHANGE
>
(
API_ON_ACCELEROMETER
,
()
=>
{
startAccelerometer
()
})
)
export
const
offAccelerometerChange
=
<
API_TYPE_OFF_ACCELEROMETER_CHANGE
>
(
defineOffApi
(
API_OFF_ACCELEROMETER
,
()
=>
{
export
const
offAccelerometerChange
=
defineOffApi
<
API_TYPE_OFF_ACCELEROMETER_CHANGE
>
(
API_OFF_ACCELEROMETER
,
()
=>
{
stopAccelerometer
()
})
)
export
const
startAccelerometer
=
<
API_TYPE_START_ACCELEROMETER
>
(
defineAsyncApi
(
API_START_ACCELEROMETER
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
startAccelerometer
=
defineAsyncApi
<
API_TYPE_START_ACCELEROMETER
>
(
API_START_ACCELEROMETER
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
!
listener
)
{
listener
=
plus
.
accelerometer
.
watchAcceleration
(
(
res
)
=>
{
...
...
@@ -49,15 +48,16 @@ export const startAccelerometer = <API_TYPE_START_ACCELEROMETER>(
}
setTimeout
(
resolve
,
DEVICE_FREQUENCY
)
}
)
}
)
export
const
stopAccelerometer
=
<
API_TYPE_STOP_ACCELEROMETER
>
(
defineAsyncApi
(
API_STOP_ACCELEROMETER
,
(
_
,
{
resolve
})
=>
{
export
const
stopAccelerometer
=
defineAsyncApi
<
API_TYPE_STOP_ACCELEROMETER
>
(
API_STOP_ACCELEROMETER
,
(
_
,
{
resolve
})
=>
{
if
(
listener
)
{
plus
.
accelerometer
.
clearWatch
(
listener
)
listener
=
null
}
resolve
()
}
)
}
)
packages/uni-app-plus/src/service/api/device/compass.ts
浏览文件 @
84969ca6
...
...
@@ -15,20 +15,23 @@ import { DEVICE_FREQUENCY } from '../constants'
let
listener
:
number
|
null
=
null
export
const
onCompassChange
=
<
API_TYPE_ON_COMPASS_CHANGE
>
(
defineOnApi
(
API_ON_COMPASS
,
()
=>
{
export
const
onCompassChange
=
defineOnApi
<
API_TYPE_ON_COMPASS_CHANGE
>
(
API_ON_COMPASS
,
()
=>
{
startCompass
()
}
)
}
)
export
const
offCompassChange
=
<
API_TYPE_OFF_COMPASS_CHANGE
>
(
defineOffApi
(
API_OFF_COMPASS
,
()
=>
{
export
const
offCompassChange
=
defineOffApi
<
API_TYPE_OFF_COMPASS_CHANGE
>
(
API_OFF_COMPASS
,
()
=>
{
stopCompass
()
}
)
}
)
export
const
startCompass
=
<
API_TYPE_START_COMPASS
>
(
defineAsyncApi
(
API_START_COMPASS
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
startCompass
=
defineAsyncApi
<
API_TYPE_START_COMPASS
>
(
API_START_COMPASS
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
!
listener
)
{
listener
=
plus
.
orientation
.
watchOrientation
(
(
res
)
=>
{
...
...
@@ -46,15 +49,16 @@ export const startCompass = <API_TYPE_START_COMPASS>(
)
}
setTimeout
(
resolve
,
DEVICE_FREQUENCY
)
}
)
}
)
export
const
stopCompass
=
<
API_TYPE_STOP_COMPASS
>
(
defineAsyncApi
(
API_STOP_COMPASS
,
(
_
,
{
resolve
})
=>
{
export
const
stopCompass
=
defineAsyncApi
<
API_TYPE_STOP_COMPASS
>
(
API_STOP_COMPASS
,
(
_
,
{
resolve
})
=>
{
if
(
listener
)
{
plus
.
orientation
.
clearWatch
(
listener
)
listener
=
null
}
resolve
()
}
)
}
)
packages/uni-app-plus/src/service/api/file/getFileInfo.ts
浏览文件 @
84969ca6
...
...
@@ -11,7 +11,7 @@ import {
warpPlusErrorCallback
,
}
from
'
../../../helpers/plus
'
export
const
getFileInfo
=
<
API_TYPE_GET_FILE_INFO
>
defineAsyncApi
(
export
const
getFileInfo
=
defineAsyncApi
<
API_TYPE_GET_FILE_INFO
>
(
API_GET_FILE_INFO
,
(
options
,
{
resolve
,
reject
})
=>
{
plus
.
io
.
getFileInfo
(
...
...
packages/uni-app-plus/src/service/api/file/getSavedFileInfo.ts
浏览文件 @
84969ca6
...
...
@@ -7,7 +7,7 @@ import {
}
from
'
@dcloudio/uni-api
'
import
{
warpPlusErrorCallback
}
from
'
../../../helpers/plus
'
export
const
getSavedFileInfo
=
<
API_TYPE_GET_SAVED_FILE_INFO
>
defineAsyncApi
(
export
const
getSavedFileInfo
=
defineAsyncApi
<
API_TYPE_GET_SAVED_FILE_INFO
>
(
API_GET_SAVED_FILE_INFO
,
({
filePath
},
{
resolve
,
reject
})
=>
{
const
errorCallback
=
warpPlusErrorCallback
(
reject
)
...
...
packages/uni-app-plus/src/service/api/file/getSavedFileList.ts
浏览文件 @
84969ca6
...
...
@@ -30,20 +30,21 @@ function getSavedFileDir(
)
}
export
const
getSavedFileList
=
<
API_TYPE_GET_SAVED_LIST
>
(
defineAsyncApi
(
API_GET_SAVED_LIST
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
getSavedFileList
=
defineAsyncApi
<
API_TYPE_GET_SAVED_LIST
>
(
API_GET_SAVED_LIST
,
(
_
,
{
resolve
,
reject
})
=>
{
const
errorCallback
=
warpPlusErrorCallback
(
reject
)
getSavedFileDir
((
entry
)
=>
{
var
reader
=
entry
.
createReader
()
var
fileList
:
object
[]
=
[]
var
fileList
:
UniApp
.
GetSavedFileListSuccessFileItem
[]
=
[]
reader
.
readEntries
((
entries
:
any
[])
=>
{
if
(
entries
&&
entries
.
length
)
{
entries
.
forEach
((
entry
)
=>
{
entry
.
getMetadata
(
(
meta
:
{
modificationTime
:
{
getTime
:
()
=>
void
}
modificationTime
:
{
getTime
:
()
=>
number
}
size
:
any
})
=>
{
fileList
.
push
({
...
...
@@ -68,5 +69,5 @@ export const getSavedFileList = <API_TYPE_GET_SAVED_LIST>(
}
},
errorCallback
)
},
errorCallback
)
}
)
}
)
packages/uni-app-plus/src/service/api/file/removeSavedFile.ts
浏览文件 @
84969ca6
...
...
@@ -7,7 +7,7 @@ import {
}
from
'
@dcloudio/uni-api
'
import
{
warpPlusErrorCallback
}
from
'
../../../helpers/plus
'
export
const
removeSavedFile
=
<
API_TYPE_REMOVE_SAVED_FILE
>
defineAsyncApi
(
export
const
removeSavedFile
=
defineAsyncApi
<
API_TYPE_REMOVE_SAVED_FILE
>
(
API_REMOVE_SAVED_FILE
,
({
filePath
},
{
resolve
,
reject
})
=>
{
const
errorCallback
=
warpPlusErrorCallback
(
reject
)
...
...
packages/uni-app-plus/src/service/api/file/saveFile.ts
浏览文件 @
84969ca6
...
...
@@ -35,7 +35,7 @@ function getSavedFileDir(
)
}
export
const
saveFile
=
<
API_TYPE_SAVE_FILE
>
defineAsyncApi
(
export
const
saveFile
=
defineAsyncApi
<
API_TYPE_SAVE_FILE
>
(
API_SAVE_FILE
,
({
tempFilePath
},
{
resolve
,
reject
})
=>
{
const
errorCallback
=
warpPlusErrorCallback
(
reject
)
...
...
packages/uni-app-plus/src/service/api/location/chooseLocation.ts
浏览文件 @
84969ca6
...
...
@@ -9,7 +9,7 @@ import { showPage } from '@dcloudio/uni-core'
import
{
getStatusBarStyle
}
from
'
../../../helpers/statusBar
'
import
{
extend
}
from
'
@vue/shared
'
export
const
chooseLocation
=
<
API_TYPE_CHOOSE_LOCATION
>
defineAsyncApi
(
export
const
chooseLocation
=
defineAsyncApi
<
API_TYPE_CHOOSE_LOCATION
>
(
API_CHOOSE_LOCATION
,
(
options
,
{
resolve
,
reject
})
=>
{
const
statusBarStyle
=
getStatusBarStyle
()
...
...
packages/uni-app-plus/src/service/api/location/getLocation.ts
浏览文件 @
84969ca6
...
...
@@ -39,7 +39,7 @@ function getLocationSuccess(
})
}
export
const
getLocation
=
<
API_TYPE_GET_LOCATION
>
defineAsyncApi
(
export
const
getLocation
=
defineAsyncApi
<
API_TYPE_GET_LOCATION
>
(
API_GET_LOCATION
,
(
{
...
...
packages/uni-app-plus/src/service/api/location/locationChange.ts
浏览文件 @
84969ca6
...
...
@@ -23,8 +23,8 @@ let watchId: number = 0
/**
* 开始更新定位
*/
export
const
startLocationUpdate
=
<
API_TYPE_START_LOCATION_UPDATE
>
(
defineAsyncApi
(
export
const
startLocationUpdate
=
defineAsyncApi
<
API_TYPE_START_LOCATION_UPDATE
>
(
API_START_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
plus
.
geolocation
&&
watchId
===
0
)
{
...
...
@@ -54,14 +54,15 @@ export const startLocationUpdate = <API_TYPE_START_LOCATION_UPDATE>(
StartLocationUpdateProtocol
,
StartLocationUpdateOptions
)
)
export
const
onLocationChange
=
<
API_TYPE_ON_LOCATION_CHANGE
>
(
defineOnApi
(
API_ON_LOCATION_CHANGE
,
()
=>
{})
export
const
onLocationChange
=
defineOnApi
<
API_TYPE_ON_LOCATION_CHANGE
>
(
API_ON_LOCATION_CHANGE
,
()
=>
{}
)
export
const
stopLocationUpdate
=
<
API_TYPE_STOP_LOCATION_UPDATE
>
(
defineAsyncApi
(
API_STOP_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
stopLocationUpdate
=
defineAsyncApi
<
API_TYPE_STOP_LOCATION_UPDATE
>
(
API_STOP_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
watchId
)
{
plus
.
geolocation
.
clearWatch
(
watchId
)
watchId
=
0
...
...
@@ -69,19 +70,24 @@ export const stopLocationUpdate = <API_TYPE_STOP_LOCATION_UPDATE>(
}
else
{
reject
(
'
stopLocationUpdate:fail
'
)
}
}
)
}
)
export
const
offLocationChange
=
<
API_TYPE_OFF_LOCATION_CHANGE
>
(
defineOffApi
(
API_OFF_LOCATION_CHANGE
,
()
=>
{
export
const
offLocationChange
=
defineOffApi
<
API_TYPE_OFF_LOCATION_CHANGE
>
(
API_OFF_LOCATION_CHANGE
,
()
=>
{
stopLocationUpdate
()
}
)
}
)
export
const
onLocationChangeError
=
<
API_TYPE_ON_LOCATION_CHANGE_ERROR
>
(
defineOnApi
(
API_ON_LOCATION_CHANGE_ERROR
,
()
=>
{})
)
export
const
onLocationChangeError
=
defineOnApi
<
API_TYPE_ON_LOCATION_CHANGE_ERROR
>
(
API_ON_LOCATION_CHANGE_ERROR
,
()
=>
{}
)
export
const
offLocationChangeError
=
<
API_TYPE_OFF_LOCATION_CHANGE_ERROR
>
(
defineOnApi
(
API_OFF_LOCATION_CHANGE_ERROR
,
()
=>
{})
)
export
const
offLocationChangeError
=
defineOnApi
<
API_TYPE_OFF_LOCATION_CHANGE_ERROR
>
(
API_OFF_LOCATION_CHANGE_ERROR
,
()
=>
{}
)
packages/uni-app-plus/src/service/api/location/openLocation.ts
浏览文件 @
84969ca6
...
...
@@ -9,7 +9,7 @@ import {
import
{
showPage
}
from
'
@dcloudio/uni-core
'
import
{
extend
}
from
'
@vue/shared
'
export
const
openLocation
=
<
API_TYPE_OPEN_LOCATION
>
defineAsyncApi
(
export
const
openLocation
=
defineAsyncApi
<
API_TYPE_OPEN_LOCATION
>
(
API_OPEN_LOCATION
,
(
data
,
{
resolve
,
reject
})
=>
{
showPage
({
...
...
packages/uni-app-plus/src/service/api/media/getVideoInfo.ts
浏览文件 @
84969ca6
...
...
@@ -7,7 +7,7 @@ import {
}
from
'
@dcloudio/uni-api
'
import
{
warpPlusErrorCallback
}
from
'
../../../helpers/plus
'
export
const
getVideoInfo
=
<
API_TYPE_GET_VIDEO_INFO
>
defineAsyncApi
(
export
const
getVideoInfo
=
defineAsyncApi
<
API_TYPE_GET_VIDEO_INFO
>
(
API_GET_VIDEO_INFO
,
(
options
,
{
resolve
,
reject
})
=>
{
plus
.
io
.
getVideoInfo
({
...
...
packages/uni-app-plus/src/service/api/media/previewImage.ts
浏览文件 @
84969ca6
...
...
@@ -14,7 +14,7 @@ import { initI18nPreviewImageMsgsOnce, useI18n } from '@dcloudio/uni-core'
import
{
getRealPath
}
from
'
../../../platform/getRealPath
'
export
const
previewImage
=
<
API_TYPE_PREVIEW_IMAGE
>
defineAsyncApi
(
export
const
previewImage
=
defineAsyncApi
<
API_TYPE_PREVIEW_IMAGE
>
(
API_PREVIEW_IMAGE
,
(
{
current
=
0
,
indicator
=
'
number
'
,
loop
=
false
,
urls
,
longPressActions
},
...
...
packages/uni-app-plus/src/service/api/storage/storage.ts
浏览文件 @
84969ca6
...
...
@@ -53,7 +53,7 @@ function parseValue(value: any) {
}
catch
(
error
)
{}
}
export
const
setStorageSync
=
<
API_TYPE_SET_STORAGE_SYNC
>
defineSyncApi
(
export
const
setStorageSync
=
defineSyncApi
<
API_TYPE_SET_STORAGE_SYNC
>
(
API_SET_STORAGE_SYNC
,
(
key
,
data
)
=>
{
const
type
=
typeof
data
...
...
@@ -76,7 +76,7 @@ export const setStorageSync = <API_TYPE_SET_STORAGE_SYNC>defineSyncApi(
SetStorageSyncProtocol
)
export
const
setStorage
=
<
API_TYPE_SET_STORAGE
>
defineAsyncApi
(
export
const
setStorage
=
defineAsyncApi
<
API_TYPE_SET_STORAGE
>
(
API_SET_STORAGE
,
({
key
,
data
},
{
resolve
,
reject
})
=>
{
const
type
=
typeof
data
...
...
@@ -135,9 +135,9 @@ function parseGetStorage(type: string, value: string) {
return
data
}
export
const
getStorageSync
=
<
API_TYPE_GET_STORAGE_SYNC
>
defineSyncApi
(
export
const
getStorageSync
=
defineSyncApi
<
API_TYPE_GET_STORAGE_SYNC
>
(
API_GET_STORAGE_SYNC
,
(
key
:
string
,
t
:
boolean
)
=>
{
(
key
:
string
)
=>
{
const
value
=
plus
.
storage
.
getItem
(
key
)
const
typeOrigin
=
plus
.
storage
.
getItem
(
key
+
STORAGE_DATA_TYPE
)
||
''
const
type
=
typeOrigin
.
toLowerCase
()
...
...
@@ -149,7 +149,7 @@ export const getStorageSync = <API_TYPE_GET_STORAGE_SYNC>defineSyncApi(
GetStorageSyncProtocol
)
export
const
getStorage
=
<
API_TYPE_GET_STORAGE
>
defineAsyncApi
(
export
const
getStorage
=
defineAsyncApi
<
API_TYPE_GET_STORAGE
>
(
API_GET_STORAGE
,
({
key
},
{
resolve
,
reject
})
=>
{
const
storage
=
plus
.
storage
...
...
@@ -179,7 +179,7 @@ export const getStorage = <API_TYPE_GET_STORAGE>defineAsyncApi(
GetStorageProtocol
)
export
const
removeStorageSync
=
<
API_TYPE_REMOVE_STORAGE_SYNC
>
defineSyncApi
(
export
const
removeStorageSync
=
defineSyncApi
<
API_TYPE_REMOVE_STORAGE_SYNC
>
(
API_REMOVE_STORAGE
,
(
key
)
=>
{
plus
.
storage
.
removeItem
(
key
+
STORAGE_DATA_TYPE
)
...
...
@@ -188,7 +188,7 @@ export const removeStorageSync = <API_TYPE_REMOVE_STORAGE_SYNC>defineSyncApi(
RemoveStorageSyncProtocol
)
export
const
removeStorage
=
<
API_TYPE_REMOVE_STORAGE
>
defineAsyncApi
(
export
const
removeStorage
=
defineAsyncApi
<
API_TYPE_REMOVE_STORAGE
>
(
API_REMOVE_STORAGE
,
({
key
},
{
resolve
,
reject
})
=>
{
// 兼容App端历史格式
...
...
@@ -198,20 +198,23 @@ export const removeStorage = <API_TYPE_REMOVE_STORAGE>defineAsyncApi(
RemoveStorageProtocol
)
export
const
clearStorageSync
=
<
typeof
uni
.
clearStorageSync
>
(
defineSyncApi
(
'
clearStorageSync
'
,
()
=>
{
export
const
clearStorageSync
=
defineSyncApi
<
typeof
uni
.
clearStorageSync
>
(
'
clearStorageSync
'
,
()
=>
{
plus
.
storage
.
clear
()
}
)
}
)
export
const
clearStorage
=
<
typeof
uni
.
clearStorage
>
(
defineAsyncApi
(
'
clearStorage
'
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
clearStorage
=
defineAsyncApi
<
typeof
uni
.
clearStorage
>
(
'
clearStorage
'
,
(
_
,
{
resolve
,
reject
})
=>
{
plus
.
storage
.
clearAsync
(
resolve
,
warpPlusErrorCallback
(
reject
))
}
)
}
)
export
const
getStorageInfoSync
=
<
typeof
uni
.
getStorageInfoSync
>
(
defineSyncApi
(
'
getStorageInfoSync
'
,
()
=>
{
export
const
getStorageInfoSync
=
defineSyncApi
<
typeof
uni
.
getStorageInfoSync
>
(
'
getStorageInfoSync
'
,
()
=>
{
const
length
=
plus
.
storage
.
getLength
()
||
0
const
keys
:
string
[]
=
[]
let
currentSize
=
0
...
...
@@ -233,11 +236,12 @@ export const getStorageInfoSync = <typeof uni.getStorageInfoSync>(
currentSize
:
Math
.
ceil
((
currentSize
*
2
)
/
1024
),
limitSize
:
Number
.
MAX_VALUE
,
}
}
)
}
)
export
const
getStorageInfo
=
<
typeof
uni
.
getStorageInfo
>
(
defineAsyncApi
(
'
getStorageInfo
'
,
(
_
,
{
resolve
})
=>
{
export
const
getStorageInfo
=
defineAsyncApi
<
typeof
uni
.
getStorageInfo
>
(
'
getStorageInfo
'
,
(
_
,
{
resolve
})
=>
{
resolve
(
getStorageInfoSync
())
}
)
}
)
packages/uni-h5-vite/lib/api.json
浏览文件 @
84969ca6
...
...
@@ -118,7 +118,7 @@
"reLaunch"
,
"redirectTo"
,
"removeInterceptor"
,
"removeSavedFile
Info
"
,
"removeSavedFile"
,
"removeStorage"
,
"removeStorageSync"
,
"removeTabBarBadge"
,
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
84969ca6
...
...
@@ -10143,7 +10143,7 @@ function getStorageOrigin(key) {
}
return
data
;
}
const
getStorageSync
=
/* @__PURE__ */
defineSyncApi
(
API_GET_STORAGE_SYNC
,
(
key
,
t2
)
=>
{
const
getStorageSync
=
/* @__PURE__ */
defineSyncApi
(
API_GET_STORAGE_SYNC
,
(
key
)
=>
{
try
{
return
getStorageOrigin
(
key
);
}
catch
(
error
)
{
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
84969ca6
...
...
@@ -17172,7 +17172,7 @@ function getStorageOrigin(key) {
}
return data;
}
const getStorageSync = /* @__PURE__ */ defineSyncApi(API_GET_STORAGE_SYNC, (key
, t2
) => {
const getStorageSync = /* @__PURE__ */ defineSyncApi(API_GET_STORAGE_SYNC, (key) => {
try {
return getStorageOrigin(key);
} catch (error) {
...
...
@@ -20562,8 +20562,8 @@ const API_GET_SAVED_FILE_LIST = "getSavedFileList";
const getSavedFileList = /* @__PURE__ */ defineAsyncApi(API_GET_SAVED_FILE_LIST, createUnsupportedAsyncApi(API_GET_SAVED_FILE_LIST));
const API_GET_SAVED_FILE_INFO = "getSavedFileInfo";
const getSavedFileInfo = /* @__PURE__ */ defineAsyncApi(API_GET_SAVED_FILE_INFO, createUnsupportedAsyncApi(API_GET_SAVED_FILE_INFO));
const API_REMOVE_SAVED_FILE
_INFO = "removeSavedFileInfo
";
const removeSavedFile
Info = /* @__PURE__ */ defineAsyncApi(API_REMOVE_SAVED_FILE_INFO, createUnsupportedAsyncApi(API_REMOVE_SAVED_FILE_INFO
));
const API_REMOVE_SAVED_FILE
= "removeSavedFile
";
const removeSavedFile
= /* @__PURE__ */ defineAsyncApi(API_REMOVE_SAVED_FILE, createUnsupportedAsyncApi(API_REMOVE_SAVED_FILE
));
const API_ON_MEMORY_WARNING = "onMemoryWarning";
const onMemoryWarning = /* @__PURE__ */ defineOnApi(API_ON_MEMORY_WARNING, createUnsupportedOnApi(API_ON_MEMORY_WARNING));
const API_ON_GYROSCOPE_CHANGE = "onGyroscopeChange";
...
...
@@ -20749,7 +20749,7 @@ var api = /* @__PURE__ */ Object.defineProperty({
saveFile,
getSavedFileList,
getSavedFileInfo,
removeSavedFile
Info
,
removeSavedFile,
onMemoryWarning,
onGyroscopeChange,
startGyroscope,
...
...
@@ -22908,4 +22908,4 @@ var index = /* @__PURE__ */ defineSystemComponent({
return openBlock(), createBlock("div", clazz, [loadingVNode]);
}
});
export { $emit, $off, $on, $once, index$8 as Ad, index$7 as AdContentPage, index$6 as AdDraw, index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, index$z as Button, index$5 as Camera, index$x as Canvas, index$v as Checkbox, index$w as CheckboxGroup, index$a as CoverImage, index$b as CoverView, index$u as Editor, index$B as Form, index$t as Icon, index$s as Image, Input, index$A as Label, LayoutComponent, index$4 as LivePlayer, index$3 as LivePusher, Map$1 as Map, MovableArea, MovableView, index$r as Navigator, index$2 as PageComponent, index$9 as Picker, PickerView, PickerViewColumn, index$q as Progress, index$o as Radio, index$p as RadioGroup, ResizeSensor, index$n as RichText, ScrollView, index$m as Slider, Swiper, SwiperItem, index$l as Switch, index$k as Text, index$j as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$f as Video, index$i as View, index$e as WebView, addInterceptor, addPhoneContact, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseLocation, chooseVideo, clearStorage, clearStorageSync, closePreviewImage, closeSocket, connectSocket, createAnimation$1 as createAnimation, createCameraContext, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createLivePlayerContext, createMapContext, createMediaQueryObserver, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, downloadFile, getApp$1 as getApp, getAppBaseInfo, getClipboardData, getCurrentPages$1 as getCurrentPages, getDeviceInfo, getEnterOptionsSync, getFileInfo, getImageInfo, getLaunchOptionsSync, getLeftWindowStyle, getLocale, getLocation, getNetworkType, getProvider, getPushClientId, getRealPath, getRecorderManager, getRightWindowStyle, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange$1 as getSelectedTextRange, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getTopWindowStyle, getVideoInfo, getWindowInfo, hideKeyboard, hideLeftWindow, hideLoading, hideNavigationBarLoading, hideRightWindow, hideTabBar, hideTabBarRedDot, hideToast, hideTopWindow, interceptors, invokePushCallback, loadFontFace, login, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offAppHide, offAppShow, offCompassChange, offError, offLocationChange, offLocationChangeError, offNetworkStatusChange, offPageNotFound, offPushMessage, offUnhandledRejection, offWindowResize, onAccelerometerChange, onAppHide, onAppShow, onCompassChange, onError, onGyroscopeChange, onLocaleChange, onLocationChange, onLocationChangeError, onMemoryWarning, onNetworkStatusChange, onPageNotFound, onPushMessage, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, onUnhandledRejection, onUserCaptureScreen, onWindowResize, openDocument, openLocation, pageScrollTo, index$g as plugin, preloadPage, previewImage, reLaunch, redirectTo, removeInterceptor, removeSavedFile
Info
, removeStorage, removeStorageSync, removeTabBarBadge, request, saveFile, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, sendSocketMessage, setClipboardData, setKeepScreenOn, setLeftWindowStyle, setLocale, setNavigationBarColor, setNavigationBarTitle, setPageMeta, setRightWindowStyle, setScreenBrightness, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setTopWindowStyle, setupApp, setupPage, setupWindow, showActionSheet, showLeftWindow, showLoading, showModal, showNavigationBarLoading, showRightWindow, showTabBar, showTabBarRedDot, showToast, showTopWindow, startAccelerometer, startCompass, startGyroscope, startLocationUpdate, startPullDownRefresh, stopAccelerometer, stopCompass, stopGyroscope, stopLocationUpdate, stopPullDownRefresh, switchTab, uni$1 as uni, uploadFile, upx2px, useI18n, useTabBar, vibrateLong, vibrateShort };
export { $emit, $off, $on, $once, index$8 as Ad, index$7 as AdContentPage, index$6 as AdDraw, index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, index$z as Button, index$5 as Camera, index$x as Canvas, index$v as Checkbox, index$w as CheckboxGroup, index$a as CoverImage, index$b as CoverView, index$u as Editor, index$B as Form, index$t as Icon, index$s as Image, Input, index$A as Label, LayoutComponent, index$4 as LivePlayer, index$3 as LivePusher, Map$1 as Map, MovableArea, MovableView, index$r as Navigator, index$2 as PageComponent, index$9 as Picker, PickerView, PickerViewColumn, index$q as Progress, index$o as Radio, index$p as RadioGroup, ResizeSensor, index$n as RichText, ScrollView, index$m as Slider, Swiper, SwiperItem, index$l as Switch, index$k as Text, index$j as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$f as Video, index$i as View, index$e as WebView, addInterceptor, addPhoneContact, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseLocation, chooseVideo, clearStorage, clearStorageSync, closePreviewImage, closeSocket, connectSocket, createAnimation$1 as createAnimation, createCameraContext, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createLivePlayerContext, createMapContext, createMediaQueryObserver, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, downloadFile, getApp$1 as getApp, getAppBaseInfo, getClipboardData, getCurrentPages$1 as getCurrentPages, getDeviceInfo, getEnterOptionsSync, getFileInfo, getImageInfo, getLaunchOptionsSync, getLeftWindowStyle, getLocale, getLocation, getNetworkType, getProvider, getPushClientId, getRealPath, getRecorderManager, getRightWindowStyle, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange$1 as getSelectedTextRange, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getTopWindowStyle, getVideoInfo, getWindowInfo, hideKeyboard, hideLeftWindow, hideLoading, hideNavigationBarLoading, hideRightWindow, hideTabBar, hideTabBarRedDot, hideToast, hideTopWindow, interceptors, invokePushCallback, loadFontFace, login, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offAppHide, offAppShow, offCompassChange, offError, offLocationChange, offLocationChangeError, offNetworkStatusChange, offPageNotFound, offPushMessage, offUnhandledRejection, offWindowResize, onAccelerometerChange, onAppHide, onAppShow, onCompassChange, onError, onGyroscopeChange, onLocaleChange, onLocationChange, onLocationChangeError, onMemoryWarning, onNetworkStatusChange, onPageNotFound, onPushMessage, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, onUnhandledRejection, onUserCaptureScreen, onWindowResize, openDocument, openLocation, pageScrollTo, index$g as plugin, preloadPage, previewImage, reLaunch, redirectTo, removeInterceptor, removeSavedFile, removeStorage, removeStorageSync, removeTabBarBadge, request, saveFile, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, sendSocketMessage, setClipboardData, setKeepScreenOn, setLeftWindowStyle, setLocale, setNavigationBarColor, setNavigationBarTitle, setPageMeta, setRightWindowStyle, setScreenBrightness, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setTopWindowStyle, setupApp, setupPage, setupWindow, showActionSheet, showLeftWindow, showLoading, showModal, showNavigationBarLoading, showRightWindow, showTabBar, showTabBarRedDot, showToast, showTopWindow, startAccelerometer, startCompass, startGyroscope, startLocationUpdate, startPullDownRefresh, stopAccelerometer, stopCompass, stopGyroscope, stopLocationUpdate, stopPullDownRefresh, switchTab, uni$1 as uni, uploadFile, upx2px, useI18n, useTabBar, vibrateLong, vibrateShort };
packages/uni-h5/src/service/api/device/accelerometer.ts
浏览文件 @
84969ca6
...
...
@@ -13,20 +13,19 @@ import {
let
listener
:
((
event
:
DeviceMotionEvent
)
=>
void
)
|
null
=
null
export
const
onAccelerometerChange
=
<
API_TYPE_ON_ACCELEROMETER_CHANGE
>
(
defineOnApi
(
API_ON_ACCELEROMETER
,
()
=>
{
export
const
onAccelerometerChange
=
defineOnApi
<
API_TYPE_ON_ACCELEROMETER_CHANGE
>
(
API_ON_ACCELEROMETER
,
()
=>
{
startAccelerometer
()
})
)
export
const
offAccelerometerChange
=
<
API_TYPE_OFF_ACCELEROMETER_CHANGE
>
(
defineOnApi
(
API_OFF_ACCELEROMETER
,
()
=>
{
export
const
offAccelerometerChange
=
defineOnApi
<
API_TYPE_OFF_ACCELEROMETER_CHANGE
>
(
API_OFF_ACCELEROMETER
,
()
=>
{
stopAccelerometer
()
})
)
export
const
startAccelerometer
=
<
API_TYPE_START_ACCELEROMETER
>
(
defineAsyncApi
(
API_START_ACCELEROMETER
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
startAccelerometer
=
defineAsyncApi
<
API_TYPE_START_ACCELEROMETER
>
(
API_START_ACCELEROMETER
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
!
window
.
DeviceMotionEvent
)
{
reject
()
return
...
...
@@ -63,15 +62,16 @@ export const startAccelerometer = <API_TYPE_START_ACCELEROMETER>(
addEventListener
()
}
resolve
()
}
)
}
)
export
const
stopAccelerometer
=
<
API_TYPE_STOP_ACCELEROMETER
>
(
defineAsyncApi
(
API_STOP_ACCELEROMETER
,
(
_
,
{
resolve
})
=>
{
export
const
stopAccelerometer
=
defineAsyncApi
<
API_TYPE_STOP_ACCELEROMETER
>
(
API_STOP_ACCELEROMETER
,
(
_
,
{
resolve
})
=>
{
if
(
listener
)
{
window
.
removeEventListener
(
'
devicemotion
'
,
listener
,
false
)
listener
=
null
}
resolve
()
}
)
}
)
packages/uni-h5/src/service/api/device/compass.ts
浏览文件 @
84969ca6
...
...
@@ -14,20 +14,23 @@ import {
let
listener
:
((
event
:
DeviceOrientationEvent
)
=>
void
)
|
null
=
null
export
const
onCompassChange
=
<
API_TYPE_ON_COMPASS_CHANGE
>
(
defineOnApi
(
API_ON_COMPASS
,
()
=>
{
export
const
onCompassChange
=
defineOnApi
<
API_TYPE_ON_COMPASS_CHANGE
>
(
API_ON_COMPASS
,
()
=>
{
startCompass
()
}
)
}
)
export
const
offCompassChange
=
<
API_TYPE_OFF_COMPASS_CHANGE
>
(
defineOffApi
(
API_OFF_COMPASS
,
()
=>
{
export
const
offCompassChange
=
defineOffApi
<
API_TYPE_OFF_COMPASS_CHANGE
>
(
API_OFF_COMPASS
,
()
=>
{
stopCompass
()
}
)
}
)
export
const
startCompass
=
<
API_TYPE_START_COMPASS
>
(
defineAsyncApi
(
API_START_COMPASS
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
startCompass
=
defineAsyncApi
<
API_TYPE_START_COMPASS
>
(
API_START_COMPASS
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
!
window
.
DeviceOrientationEvent
)
{
reject
()
return
...
...
@@ -62,15 +65,16 @@ export const startCompass = <API_TYPE_START_COMPASS>(
addEventListener
()
}
resolve
()
}
)
}
)
export
const
stopCompass
=
<
API_TYPE_STOP_COMPASS
>
(
defineAsyncApi
(
API_STOP_COMPASS
,
(
_
,
{
resolve
})
=>
{
export
const
stopCompass
=
defineAsyncApi
<
API_TYPE_STOP_COMPASS
>
(
API_STOP_COMPASS
,
(
_
,
{
resolve
})
=>
{
if
(
listener
)
{
window
.
removeEventListener
(
'
deviceorientation
'
,
listener
,
false
)
listener
=
null
}
resolve
()
}
)
}
)
packages/uni-h5/src/service/api/location/chooseLocation/index.ts
浏览文件 @
84969ca6
...
...
@@ -10,7 +10,7 @@ import LoctaionPicker, { Props, Poi } from './LoctaionPicker'
let
state
:
Props
|
null
=
null
export
const
chooseLocation
=
<
API_TYPE_CHOOSE_LOCATION
>
defineAsyncApi
(
export
const
chooseLocation
=
defineAsyncApi
<
API_TYPE_CHOOSE_LOCATION
>
(
API_CHOOSE_LOCATION
,
(
args
,
{
resolve
,
reject
})
=>
{
if
(
!
state
)
{
...
...
packages/uni-h5/src/service/api/location/getLocation.ts
浏览文件 @
84969ca6
...
...
@@ -14,7 +14,7 @@ import {
import
{
getJSONP
}
from
'
../../../helpers/getJSONP
'
import
{
request
}
from
'
../network/request
'
export
const
getLocation
=
<
API_TYPE_GET_LOCATION
>
defineAsyncApi
(
export
const
getLocation
=
defineAsyncApi
<
API_TYPE_GET_LOCATION
>
(
API_GET_LOCATION
,
(
{
type
,
altitude
,
highAccuracyExpireTime
,
isHighAccuracy
},
...
...
packages/uni-h5/src/service/api/location/locationChange.ts
浏览文件 @
84969ca6
...
...
@@ -24,8 +24,8 @@ let watchId: number = 0
/**
* 开始更新定位
*/
export
const
startLocationUpdate
=
<
API_TYPE_START_LOCATION_UPDATE
>
(
defineAsyncApi
(
export
const
startLocationUpdate
=
defineAsyncApi
<
API_TYPE_START_LOCATION_UPDATE
>
(
API_START_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
navigator
.
geolocation
&&
watchId
===
0
)
{
...
...
@@ -53,14 +53,15 @@ export const startLocationUpdate = <API_TYPE_START_LOCATION_UPDATE>(
StartLocationUpdateProtocol
,
StartLocationUpdateOptions
)
)
export
const
onLocationChange
=
<
API_TYPE_ON_LOCATION_CHANGE
>
(
defineOnApi
(
API_ON_LOCATION_CHANGE
,
()
=>
{})
export
const
onLocationChange
=
defineOnApi
<
API_TYPE_ON_LOCATION_CHANGE
>
(
API_ON_LOCATION_CHANGE
,
()
=>
{}
)
export
const
stopLocationUpdate
=
<
API_TYPE_STOP_LOCATION_UPDATE
>
(
defineAsyncApi
(
API_STOP_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
stopLocationUpdate
=
defineAsyncApi
<
API_TYPE_STOP_LOCATION_UPDATE
>
(
API_STOP_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
watchId
)
{
navigator
.
geolocation
.
clearWatch
(
watchId
)
watchId
=
0
...
...
@@ -68,19 +69,24 @@ export const stopLocationUpdate = <API_TYPE_STOP_LOCATION_UPDATE>(
}
else
{
reject
(
'
stopLocationUpdate:fail
'
)
}
}
)
}
)
export
const
offLocationChange
=
<
API_TYPE_OFF_LOCATION_CHANGE
>
(
defineOffApi
(
API_OFF_LOCATION_CHANGE
,
()
=>
{
export
const
offLocationChange
=
defineOffApi
<
API_TYPE_OFF_LOCATION_CHANGE
>
(
API_OFF_LOCATION_CHANGE
,
()
=>
{
stopLocationUpdate
()
}
)
}
)
export
const
onLocationChangeError
=
<
API_TYPE_ON_LOCATION_CHANGE_ERROR
>
(
defineOnApi
(
API_ON_LOCATION_CHANGE_ERROR
,
()
=>
{})
)
export
const
onLocationChangeError
=
defineOnApi
<
API_TYPE_ON_LOCATION_CHANGE_ERROR
>
(
API_ON_LOCATION_CHANGE_ERROR
,
()
=>
{}
)
export
const
offLocationChangeError
=
<
API_TYPE_OFF_LOCATION_CHANGE_ERROR
>
(
defineOnApi
(
API_OFF_LOCATION_CHANGE_ERROR
,
()
=>
{})
)
export
const
offLocationChangeError
=
defineOnApi
<
API_TYPE_OFF_LOCATION_CHANGE_ERROR
>
(
API_OFF_LOCATION_CHANGE_ERROR
,
()
=>
{}
)
packages/uni-h5/src/service/api/location/openLocation/index.ts
浏览文件 @
84969ca6
...
...
@@ -12,7 +12,7 @@ import LocationView, { Props } from './LocationView'
let
state
:
Props
|
null
=
null
export
const
openLocation
=
<
API_TYPE_OPEN_LOCATION
>
defineAsyncApi
(
export
const
openLocation
=
defineAsyncApi
<
API_TYPE_OPEN_LOCATION
>
(
API_OPEN_LOCATION
,
(
args
,
{
resolve
})
=>
{
if
(
!
state
)
{
...
...
packages/uni-h5/src/service/api/media/getVideoInfo.ts
浏览文件 @
84969ca6
...
...
@@ -8,7 +8,7 @@ import {
import
{
urlToFile
}
from
'
../../../helpers/file
'
export
const
getVideoInfo
=
<
API_TYPE_GET_VIDEO_INFO
>
defineAsyncApi
(
export
const
getVideoInfo
=
defineAsyncApi
<
API_TYPE_GET_VIDEO_INFO
>
(
API_GET_VIDEO_INFO
,
({
src
},
{
resolve
,
reject
})
=>
{
urlToFile
(
src
,
true
)
...
...
packages/uni-h5/src/service/api/media/previewImage/index.ts
浏览文件 @
84969ca6
...
...
@@ -23,7 +23,7 @@ const closePreviewImageView = () => {
})
}
export
const
previewImage
=
<
API_TYPE_PREVIEW_IMAGE
>
defineAsyncApi
(
export
const
previewImage
=
defineAsyncApi
<
API_TYPE_PREVIEW_IMAGE
>
(
API_PREVIEW_IMAGE
,
(
args
,
{
resolve
})
=>
{
if
(
!
state
)
{
...
...
packages/uni-h5/src/service/api/network/socket.ts
浏览文件 @
84969ca6
...
...
@@ -214,7 +214,7 @@ export const sendSocketMessage = defineAsyncApi<API_TYPE_SEND_SOCKET_MESSAGE>(
SendSocketMessageProtocol
)
export
const
closeSocket
=
<
API_TYPE_CLOSE_SOCKET
>
defineAsyncApi
(
export
const
closeSocket
=
defineAsyncApi
<
API_TYPE_CLOSE_SOCKET
>
(
API_CLOSE_SOCKET
,
(
options
,
{
resolve
,
reject
})
=>
{
const
socketTask
=
socketTasks
[
0
]
...
...
packages/uni-h5/src/service/api/storage/storage.ts
浏览文件 @
84969ca6
...
...
@@ -51,7 +51,7 @@ function parseValue(value: any) {
}
catch
(
error
)
{}
}
export
const
setStorageSync
=
<
API_TYPE_SET_STORAGE_SYNC
>
defineSyncApi
(
export
const
setStorageSync
=
defineSyncApi
<
API_TYPE_SET_STORAGE_SYNC
>
(
API_SET_STORAGE_SYNC
,
(
key
,
data
)
=>
{
const
type
=
typeof
data
...
...
@@ -67,7 +67,7 @@ export const setStorageSync = <API_TYPE_SET_STORAGE_SYNC>defineSyncApi(
SetStorageSyncProtocol
)
export
const
setStorage
=
<
API_TYPE_SET_STORAGE
>
defineAsyncApi
(
export
const
setStorage
=
defineAsyncApi
<
API_TYPE_SET_STORAGE
>
(
API_SET_STORAGE
,
({
key
,
data
},
{
resolve
,
reject
})
=>
{
try
{
...
...
@@ -96,9 +96,9 @@ function getStorageOrigin(key: string): any {
return
data
}
export
const
getStorageSync
=
<
API_TYPE_GET_STORAGE_SYNC
>
defineSyncApi
(
export
const
getStorageSync
=
defineSyncApi
<
API_TYPE_GET_STORAGE_SYNC
>
(
API_GET_STORAGE_SYNC
,
(
key
:
string
,
t
:
boolean
)
=>
{
(
key
:
string
)
=>
{
try
{
return
getStorageOrigin
(
key
)
}
catch
(
error
)
{
...
...
@@ -108,7 +108,7 @@ export const getStorageSync = <API_TYPE_GET_STORAGE_SYNC>defineSyncApi(
GetStorageSyncProtocol
)
export
const
getStorage
=
<
API_TYPE_GET_STORAGE
>
defineAsyncApi
(
export
const
getStorage
=
defineAsyncApi
<
API_TYPE_GET_STORAGE
>
(
API_GET_STORAGE
,
({
key
},
{
resolve
,
reject
})
=>
{
try
{
...
...
@@ -123,7 +123,7 @@ export const getStorage = <API_TYPE_GET_STORAGE>defineAsyncApi(
GetStorageProtocol
)
export
const
removeStorageSync
=
<
API_TYPE_REMOVE_STORAGE_SYNC
>
defineSyncApi
(
export
const
removeStorageSync
=
defineSyncApi
<
API_TYPE_REMOVE_STORAGE_SYNC
>
(
API_REMOVE_STORAGE
,
(
key
)
=>
{
if
(
localStorage
)
{
...
...
@@ -133,7 +133,7 @@ export const removeStorageSync = <API_TYPE_REMOVE_STORAGE_SYNC>defineSyncApi(
RemoveStorageSyncProtocol
)
export
const
removeStorage
=
<
API_TYPE_REMOVE_STORAGE
>
defineAsyncApi
(
export
const
removeStorage
=
defineAsyncApi
<
API_TYPE_REMOVE_STORAGE
>
(
API_REMOVE_STORAGE
,
({
key
},
{
resolve
})
=>
{
removeStorageSync
(
key
)
...
...
@@ -142,23 +142,26 @@ export const removeStorage = <API_TYPE_REMOVE_STORAGE>defineAsyncApi(
RemoveStorageProtocol
)
export
const
clearStorageSync
=
<
typeof
uni
.
clearStorageSync
>
(
defineSyncApi
(
'
clearStorageSync
'
,
()
=>
{
export
const
clearStorageSync
=
defineSyncApi
<
typeof
uni
.
clearStorageSync
>
(
'
clearStorageSync
'
,
()
=>
{
if
(
localStorage
)
{
localStorage
.
clear
()
}
}
)
}
)
export
const
clearStorage
=
<
typeof
uni
.
clearStorage
>
(
defineAsyncApi
(
'
clearStorage
'
,
(
_
,
{
resolve
})
=>
{
export
const
clearStorage
=
defineAsyncApi
<
typeof
uni
.
clearStorage
>
(
'
clearStorage
'
,
(
_
,
{
resolve
})
=>
{
clearStorageSync
()
resolve
()
}
)
}
)
export
const
getStorageInfoSync
=
<
typeof
uni
.
getStorageInfoSync
>
(
defineSyncApi
(
'
getStorageInfoSync
'
,
()
=>
{
export
const
getStorageInfoSync
=
defineSyncApi
<
typeof
uni
.
getStorageInfoSync
>
(
'
getStorageInfoSync
'
,
()
=>
{
const
length
=
(
localStorage
&&
localStorage
.
length
)
||
0
const
keys
=
[]
let
currentSize
=
0
...
...
@@ -175,11 +178,12 @@ export const getStorageInfoSync = <typeof uni.getStorageInfoSync>(
currentSize
:
Math
.
ceil
((
currentSize
*
2
)
/
1024
),
limitSize
:
Number
.
MAX_VALUE
,
}
}
)
}
)
export
const
getStorageInfo
=
<
typeof
uni
.
getStorageInfo
>
(
defineAsyncApi
(
'
getStorageInfo
'
,
(
_
,
{
resolve
})
=>
{
export
const
getStorageInfo
=
defineAsyncApi
<
typeof
uni
.
getStorageInfo
>
(
'
getStorageInfo
'
,
(
_
,
{
resolve
})
=>
{
resolve
(
getStorageInfoSync
())
}
)
}
)
packages/uni-h5/src/service/api/todo/index.ts
浏览文件 @
84969ca6
...
...
@@ -59,10 +59,10 @@ export const getSavedFileInfo = defineAsyncApi<typeof uni.getSavedFileInfo>(
API_GET_SAVED_FILE_INFO
,
createUnsupportedAsyncApi
(
API_GET_SAVED_FILE_INFO
)
)
const
API_REMOVE_SAVED_FILE
_INFO
=
'
removeSavedFileInfo
'
export
const
removeSavedFile
Info
=
defineAsyncApi
(
API_REMOVE_SAVED_FILE
_INFO
,
createUnsupportedAsyncApi
(
API_REMOVE_SAVED_FILE
_INFO
)
const
API_REMOVE_SAVED_FILE
=
'
removeSavedFile
'
export
const
removeSavedFile
=
defineAsyncApi
<
typeof
uni
.
removeSavedFile
>
(
API_REMOVE_SAVED_FILE
,
createUnsupportedAsyncApi
(
API_REMOVE_SAVED_FILE
)
)
const
API_ON_MEMORY_WARNING
=
'
onMemoryWarning
'
...
...
packages/uni-h5/src/service/api/ui/window.ts
浏览文件 @
84969ca6
...
...
@@ -3,8 +3,9 @@ import { nextTick } from 'vue'
import
{
defineAsyncApi
,
defineSyncApi
}
from
'
@dcloudio/uni-api
'
import
{
getLayoutState
}
from
'
../../../framework/components/layout
'
export
const
showTopWindow
=
<
typeof
uni
.
showTopWindow
>
(
defineAsyncApi
(
'
showTopWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
showTopWindow
=
defineAsyncApi
<
typeof
uni
.
showTopWindow
>
(
'
showTopWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
const
state
=
getLayoutState
()
if
(
!
state
)
{
reject
()
...
...
@@ -12,11 +13,12 @@ export const showTopWindow = <typeof uni.showTopWindow>(
}
state
.
apiShowTopWindow
=
true
nextTick
(
resolve
)
}
)
}
)
export
const
hideTopWindow
=
<
typeof
uni
.
hideTopWindow
>
(
defineAsyncApi
(
'
hideTopWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
hideTopWindow
=
defineAsyncApi
<
typeof
uni
.
hideTopWindow
>
(
'
hideTopWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
const
state
=
getLayoutState
()
if
(
!
state
)
{
reject
()
...
...
@@ -24,11 +26,12 @@ export const hideTopWindow = <typeof uni.hideTopWindow>(
}
state
.
apiShowTopWindow
=
false
nextTick
(
resolve
)
}
)
}
)
export
const
showLeftWindow
=
<
typeof
uni
.
showLeftWindow
>
(
defineAsyncApi
(
'
showLeftWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
showLeftWindow
=
defineAsyncApi
<
typeof
uni
.
showLeftWindow
>
(
'
showLeftWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
const
state
=
getLayoutState
()
if
(
!
state
)
{
reject
()
...
...
@@ -36,11 +39,12 @@ export const showLeftWindow = <typeof uni.showLeftWindow>(
}
state
.
apiShowLeftWindow
=
true
nextTick
(
resolve
)
}
)
}
)
export
const
hideLeftWindow
=
<
typeof
uni
.
hideLeftWindow
>
(
defineAsyncApi
(
'
hideLeftWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
hideLeftWindow
=
defineAsyncApi
<
typeof
uni
.
hideLeftWindow
>
(
'
hideLeftWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
const
state
=
getLayoutState
()
if
(
!
state
)
{
reject
()
...
...
@@ -48,11 +52,12 @@ export const hideLeftWindow = <typeof uni.hideLeftWindow>(
}
state
.
apiShowLeftWindow
=
false
nextTick
(
resolve
)
}
)
}
)
export
const
showRightWindow
=
<
typeof
uni
.
showRightWindow
>
(
defineAsyncApi
(
'
showRightWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
showRightWindow
=
defineAsyncApi
<
typeof
uni
.
showRightWindow
>
(
'
showRightWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
const
state
=
getLayoutState
()
if
(
!
state
)
{
reject
()
...
...
@@ -60,11 +65,12 @@ export const showRightWindow = <typeof uni.showRightWindow>(
}
state
.
apiShowRightWindow
=
true
nextTick
(
resolve
)
}
)
}
)
export
const
hideRightWindow
=
<
typeof
uni
.
hideRightWindow
>
(
defineAsyncApi
(
'
hideRightWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
export
const
hideRightWindow
=
defineAsyncApi
<
typeof
uni
.
hideRightWindow
>
(
'
hideRightWindow
'
,
(
_
,
{
resolve
,
reject
})
=>
{
const
state
=
getLayoutState
()
if
(
!
state
)
{
reject
()
...
...
@@ -72,53 +78,57 @@ export const hideRightWindow = <typeof uni.hideRightWindow>(
}
state
.
apiShowRightWindow
=
false
nextTick
(
resolve
)
}
)
}
)
export
const
getTopWindowStyle
=
<
typeof
uni
.
getTopWindowStyle
>
(
defineSyncApi
(
'
getTopWindowStyle
'
,
()
=>
{
export
const
getTopWindowStyle
=
defineSyncApi
<
typeof
uni
.
getTopWindowStyle
>
(
'
getTopWindowStyle
'
,
()
=>
{
const
state
=
getLayoutState
()
return
extend
({},
state
&&
state
.
topWindowStyle
)
}
)
}
)
export
const
setTopWindowStyle
=
<
typeof
uni
.
setTopWindowStyle
>
(
defineSyncApi
(
'
setTopWindowStyle
'
,
(
style
)
=>
{
export
const
setTopWindowStyle
=
defineSyncApi
<
typeof
uni
.
setTopWindowStyle
>
(
'
setTopWindowStyle
'
,
(
style
)
=>
{
const
state
=
getLayoutState
()
if
(
state
)
{
state
.
topWindowStyle
=
style
}
}
)
}
)
export
const
getLeftWindowStyle
=
<
typeof
uni
.
getLeftWindowStyle
>
(
defineSyncApi
(
'
getLeftWindowStyle
'
,
()
=>
{
export
const
getLeftWindowStyle
=
defineSyncApi
<
typeof
uni
.
getLeftWindowStyle
>
(
'
getLeftWindowStyle
'
,
()
=>
{
const
state
=
getLayoutState
()
return
extend
({},
state
&&
state
.
leftWindowStyle
)
}
)
}
)
export
const
setLeftWindowStyle
=
<
typeof
uni
.
setLeftWindowStyle
>
(
defineSyncApi
(
'
setLeftWindowStyle
'
,
(
style
)
=>
{
export
const
setLeftWindowStyle
=
defineSyncApi
<
typeof
uni
.
setLeftWindowStyle
>
(
'
setLeftWindowStyle
'
,
(
style
)
=>
{
const
state
=
getLayoutState
()
if
(
state
)
{
state
.
leftWindowStyle
=
style
}
}
)
}
)
export
const
getRightWindowStyle
=
<
typeof
uni
.
getRightWindowStyle
>
(
defineSyncApi
(
'
getRightWindowStyle
'
,
()
=>
{
const
state
=
getLayoutState
()
return
extend
({},
state
&&
state
.
rightWindowStyle
)
}
)
)
export
const
getRightWindowStyle
=
defineSyncApi
<
typeof
uni
.
getRightWindowStyle
>
(
'
getRightWindowStyle
'
,
()
=>
{
const
state
=
getLayoutState
(
)
return
extend
({},
state
&&
state
.
rightWindowStyle
)
}
)
export
const
setRightWindowStyle
=
<
typeof
uni
.
setRightWindowStyle
>
(
defineSyncApi
(
'
setRightWindowStyle
'
,
(
style
)
=>
{
const
state
=
getLayoutState
()
if
(
state
)
{
state
.
rightWindowStyle
=
style
}
}
)
)
export
const
setRightWindowStyle
=
defineSyncApi
<
typeof
uni
.
setRightWindowStyle
>
(
'
setRightWindowStyle
'
,
(
style
)
=>
{
const
state
=
getLayoutState
()
if
(
state
)
{
state
.
rightWindowStyle
=
style
}
}
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录