Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzj-java
uni-app
提交
b91abffa
U
uni-app
项目概览
wzj-java
/
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,发现更多精彩内容 >>
提交
b91abffa
编写于
6月 16, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: typeof x === 'function' => isFunction
上级
21bbe4a3
变更
37
展开全部
隐藏空白更改
内联
并排
Showing
37 changed file
with
119 addition
and
130 deletion
+119
-130
packages/uni-api/src/service/ui/createSelectorQuery.ts
packages/uni-api/src/service/ui/createSelectorQuery.ts
+3
-3
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+3
-3
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+14
-14
packages/uni-app-plus/src/helpers/plus.ts
packages/uni-app-plus/src/helpers/plus.ts
+3
-3
packages/uni-app-plus/src/service/api/ad/adBase.ts
packages/uni-app-plus/src/service/api/ad/adBase.ts
+2
-1
packages/uni-app-plus/src/service/api/context/createInnerAudioContext.ts
...p-plus/src/service/api/context/createInnerAudioContext.ts
+3
-3
packages/uni-app-plus/src/service/api/media/getRecorderManager.ts
.../uni-app-plus/src/service/api/media/getRecorderManager.ts
+2
-2
packages/uni-app-plus/src/service/api/media/previewImage.ts
packages/uni-app-plus/src/service/api/media/previewImage.ts
+5
-5
packages/uni-app-plus/src/service/api/network/downloadFile.ts
...ages/uni-app-plus/src/service/api/network/downloadFile.ts
+2
-2
packages/uni-app-plus/src/service/api/network/socket.ts
packages/uni-app-plus/src/service/api/network/socket.ts
+2
-2
packages/uni-app-plus/src/service/api/network/uploadFile.ts
packages/uni-app-plus/src/service/api/network/uploadFile.ts
+2
-2
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/asset.ts
...s/uni-cli-shared/src/vite/plugins/vitejs/plugins/asset.ts
+2
-1
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
...ges/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
+3
-3
packages/uni-components/dist/components.js
packages/uni-components/dist/components.js
+3
-3
packages/uni-components/src/helpers/scroller/Scroller.ts
packages/uni-components/src/helpers/scroller/Scroller.ts
+5
-4
packages/uni-components/src/helpers/useField.ts
packages/uni-components/src/helpers/useField.ts
+2
-5
packages/uni-components/src/helpers/useTouchtrack.ts
packages/uni-components/src/helpers/useTouchtrack.ts
+2
-1
packages/uni-components/src/nvue/helpers/common.ts
packages/uni-components/src/nvue/helpers/common.ts
+0
-4
packages/uni-components/src/nvue/movable-view/useTouchtrack.ts
...ges/uni-components/src/nvue/movable-view/useTouchtrack.ts
+2
-1
packages/uni-components/src/vue/canvas/index.tsx
packages/uni-components/src/vue/canvas/index.tsx
+2
-2
packages/uni-core/src/helpers/showPage.ts
packages/uni-core/src/helpers/showPage.ts
+2
-2
packages/uni-h5-vite/src/plugins/css.ts
packages/uni-h5-vite/src/plugins/css.ts
+2
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+3
-3
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+18
-18
packages/uni-h5/src/helpers/getJSONP.ts
packages/uni-h5/src/helpers/getJSONP.ts
+4
-3
packages/uni-h5/src/service/api/base/getBrowserInfo.ts
packages/uni-h5/src/service/api/base/getBrowserInfo.ts
+2
-1
packages/uni-h5/src/service/api/context/createInnerAudioContext.ts
...uni-h5/src/service/api/context/createInnerAudioContext.ts
+2
-1
packages/uni-h5/src/service/api/network/downloadFile.ts
packages/uni-h5/src/service/api/network/downloadFile.ts
+3
-2
packages/uni-h5/src/service/api/network/socket.ts
packages/uni-h5/src/service/api/network/socket.ts
+2
-2
packages/uni-h5/src/service/api/network/uploadFile.ts
packages/uni-h5/src/service/api/network/uploadFile.ts
+2
-2
packages/uni-h5/src/view/components/map/MapMarker.tsx
packages/uni-h5/src/view/components/map/MapMarker.tsx
+2
-1
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+4
-8
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+0
-4
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+5
-9
packages/uni-shared/src/debounce.ts
packages/uni-shared/src/debounce.ts
+0
-4
packages/uni-shared/src/plus.ts
packages/uni-shared/src/plus.ts
+2
-1
packages/uni-shared/src/utils.ts
packages/uni-shared/src/utils.ts
+4
-4
未找到文件。
packages/uni-api/src/service/ui/createSelectorQuery.ts
浏览文件 @
b91abffa
import
{
ComponentInternalInstance
,
ComponentPublicInstance
}
from
'
vue
'
import
{
isArray
}
from
'
@vue/shared
'
import
{
isArray
,
isFunction
}
from
'
@vue/shared
'
import
{
resolveComponentInstance
}
from
'
@dcloudio/uni-shared
'
import
{
getCurrentPageVm
,
getPageIdByVm
}
from
'
@dcloudio/uni-core
'
import
{
requestComponentInfo
}
from
'
@dcloudio/uni-platform
'
...
...
@@ -146,12 +146,12 @@ class SelectorQuery implements UniApp.SelectorQuery {
convertContext
(
result
)
}
const
queueCb
=
queueCbs
[
index
]
if
(
typeof
queueCb
===
'
function
'
)
{
if
(
isFunction
(
queueCb
)
)
{
queueCb
.
call
(
this
,
result
)
}
})
// isFn(callback) &&
if
(
typeof
callback
===
'
function
'
)
{
if
(
isFunction
(
callback
)
)
{
callback
.
call
(
this
,
res
)
}
}
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
b91abffa
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
b91abffa
...
...
@@ -1766,7 +1766,7 @@ function showPage({ context = {}, url, data = {}, style = {}, onMessage, onClose
});
page.addEventListener('close', onClose);
addEventListener(pageId, (message) => {
if (
typeof onMessage === 'function'
) {
if (
isFunction(onMessage)
) {
onMessage(message.data);
}
if (!message.keep) {
...
...
@@ -10753,12 +10753,12 @@ class SelectorQuery {
convertContext(result);
}
const queueCb = queueCbs[index];
if (
typeof queueCb === 'function'
) {
if (
isFunction(queueCb)
) {
queueCb.call(this, result);
}
});
// isFn(callback) &&
if (
typeof callback === 'function'
) {
if (
isFunction(callback)
) {
callback.call(this, res);
}
});
...
...
@@ -12677,7 +12677,7 @@ function warpPlusSuccessCallback(resolve, after) {
return function successCallback(data) {
delete data.code;
delete data.message;
if (
typeof after === 'function'
) {
if (
isFunction(after)
) {
data = after(data);
}
resolve(data);
...
...
@@ -12707,7 +12707,7 @@ function warpPlusEvent(plusObject, event) {
function warpPlusMethod(plusObject, before, after) {
return function (options, { resolve, reject }) {
const object = plusObject();
object(extend({},
typeof before === 'function'
? before(options) : options, {
object(extend({},
isFunction(before)
? before(options) : options, {
success: warpPlusSuccessCallback(resolve, after),
fail: warpPlusErrorCallback(reject),
}));
...
...
@@ -14120,7 +14120,7 @@ const previewImage = defineAsyncApi(API_PREVIEW_IMAGE, ({ current = 0, indicator
plus.nativeUI.actionSheet(options, (e) => {
if (e.index > 0) {
if (hasLongPressActions) {
typeof longPressActions.success === 'function'
&&
isFunction(longPressActions.success)
&&
longPressActions.success({
tapIndex: e.index - 1,
index: res.index,
...
...
@@ -14134,7 +14134,7 @@ const previewImage = defineAsyncApi(API_PREVIEW_IMAGE, ({ current = 0, indicator
});
}
else if (hasLongPressActions) {
typeof longPressActions.fail === 'function'
&&
isFunction(longPressActions.fail)
&&
longPressActions.fail({
errMsg: 'showActionSheet:fail cancel',
});
...
...
@@ -14219,7 +14219,7 @@ function onRecorderStateChange(res) {
const state = res.state;
delete res.state;
delete res.errMsg;
if (state &&
typeof callbacks$1[state] === 'function'
) {
if (state &&
isFunction(callbacks$1[state])
) {
callbacks$1[state](res);
}
}
...
...
@@ -14500,7 +14500,7 @@ class DownloadTask {
this._downloader.abort();
}
onProgressUpdate(callback) {
if (
typeof callback !== 'function'
) {
if (
!isFunction(callback)
) {
return;
}
this._callbacks.push(callback);
...
...
@@ -14851,7 +14851,7 @@ class SocketTask {
}
// WYQ fix: App平台修复websocket onOpen时发送数据报错的Bug
this._callbacks[name].forEach((callback) => {
if (
typeof callback === 'function'
) {
if (
isFunction(callback)
) {
callback(data);
}
});
...
...
@@ -14974,7 +14974,7 @@ class UploadTask {
this._uploader.abort();
}
onProgressUpdate(callback) {
if (
typeof callback !== 'function'
) {
if (
!isFunction(callback)
) {
return;
}
this._callbacks.push(callback);
...
...
@@ -15293,7 +15293,7 @@ const initInnerAudioContextEventOnce = /*#__PURE__*/ once(() => {
// 批量设置音频上下文事件监听方法
innerAudioContextEventNames.forEach((eventName) => {
InnerAudioContext.prototype[eventName] = function (callback) {
if (
typeof callback === 'function'
) {
if (
isFunction(callback)
) {
this._callbacks[eventName].push(callback);
}
};
...
...
@@ -15312,7 +15312,7 @@ const initInnerAudioContextEventOnce = /*#__PURE__*/ once(() => {
function emit(audio, state, errMsg, errCode) {
const name = `on${capitalize(state)}`;
audio._callbacks[name].forEach((callback) => {
if (
typeof callback === 'function'
) {
if (
isFunction(callback)
) {
callback(state === 'error'
? {
errMsg,
...
...
@@ -16879,7 +16879,7 @@ class AdEventHandler {
this._removeEventListener(EventType.error, callback);
}
_addEventListener(type, callback) {
if (
typeof callback !== 'function'
) {
if (
!isFunction(callback)
) {
return;
}
if (!this._callbacks[type]) {
...
...
packages/uni-app-plus/src/helpers/plus.ts
浏览文件 @
b91abffa
import
{
extend
,
isArray
}
from
'
@vue/shared
'
import
{
extend
,
isArray
,
isFunction
}
from
'
@vue/shared
'
import
{
addLeadingSlash
,
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
getRouteOptions
}
from
'
@dcloudio/uni-core
'
interface
PlusResult
extends
Record
<
string
,
any
>
{
...
...
@@ -17,7 +17,7 @@ export function warpPlusSuccessCallback(
return
function
successCallback
(
data
:
PlusResult
)
{
delete
data
.
code
delete
data
.
message
if
(
typeof
after
===
'
function
'
)
{
if
(
isFunction
(
after
)
)
{
data
=
after
(
data
)
}
resolve
(
data
)
...
...
@@ -58,7 +58,7 @@ export function warpPlusMethod(
)
{
const
object
=
plusObject
()
object
(
extend
({},
typeof
before
===
'
function
'
?
before
(
options
)
:
options
,
{
extend
({},
isFunction
(
before
)
?
before
(
options
)
:
options
,
{
success
:
warpPlusSuccessCallback
(
resolve
,
after
),
fail
:
warpPlusErrorCallback
(
reject
),
})
...
...
packages/uni-app-plus/src/service/api/ad/adBase.ts
浏览文件 @
b91abffa
import
{
isFunction
}
from
'
@vue/shared
'
const
EventType
=
{
load
:
'
load
'
,
close
:
'
close
'
,
...
...
@@ -42,7 +43,7 @@ class AdEventHandler {
}
_addEventListener
(
type
:
string
,
callback
:
Function
)
{
if
(
typeof
callback
!==
'
function
'
)
{
if
(
!
isFunction
(
callback
)
)
{
return
}
if
(
!
this
.
_callbacks
[
type
])
{
...
...
packages/uni-app-plus/src/service/api/context/createInnerAudioContext.ts
浏览文件 @
b91abffa
import
{
extend
,
capitalize
}
from
'
@vue/shared
'
import
{
extend
,
capitalize
,
isFunction
}
from
'
@vue/shared
'
import
{
API_CREATE_INNER_AUDIO_CONTEXT
,
defineSyncApi
,
...
...
@@ -436,7 +436,7 @@ const initInnerAudioContextEventOnce = /*#__PURE__*/ once(() => {
// 批量设置音频上下文事件监听方法
innerAudioContextEventNames
.
forEach
((
eventName
)
=>
{
InnerAudioContext
.
prototype
[
eventName
]
=
function
(
callback
:
Function
)
{
if
(
typeof
callback
===
'
function
'
)
{
if
(
isFunction
(
callback
)
)
{
this
.
_callbacks
[
eventName
]
!
.
push
(
callback
)
}
}
...
...
@@ -462,7 +462,7 @@ function emit(
)
{
const
name
=
`on
${
capitalize
(
state
)}
`
as
InnerAudioContextEvent
audio
.
_callbacks
[
name
]
!
.
forEach
((
callback
)
=>
{
if
(
typeof
callback
===
'
function
'
)
{
if
(
isFunction
(
callback
)
)
{
callback
(
state
===
'
error
'
?
{
...
...
packages/uni-app-plus/src/service/api/media/getRecorderManager.ts
浏览文件 @
b91abffa
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isFunction
}
from
'
@vue/shared
'
import
{
API_GET_RECORDER_MANAGER
,
API_TYPE_GET_RECORDER_MANAGER
,
...
...
@@ -98,7 +98,7 @@ function onRecorderStateChange(res: { state?: string; errMsg?: string }) {
const
state
=
res
.
state
delete
res
.
state
delete
res
.
errMsg
if
(
state
&&
typeof
callbacks
[
state
]
===
'
function
'
)
{
if
(
state
&&
isFunction
(
callbacks
[
state
])
)
{
callbacks
[
state
]
!
(
res
)
}
}
...
...
packages/uni-app-plus/src/service/api/media/previewImage.ts
浏览文件 @
b91abffa
...
...
@@ -8,7 +8,7 @@ import {
API_TYPE_CLOSE_PREVIEW_IMAGE
,
}
from
'
@dcloudio/uni-api
'
import
{
isPlainObject
}
from
'
@vue/shared
'
import
{
is
Function
,
is
PlainObject
}
from
'
@vue/shared
'
import
{
initI18nPreviewImageMsgsOnce
,
useI18n
}
from
'
@dcloudio/uni-core
'
...
...
@@ -67,8 +67,8 @@ export const previewImage = <API_TYPE_PREVIEW_IMAGE>defineAsyncApi(
plus
.
nativeUI
.
actionSheet
(
options
,
(
e
)
=>
{
if
(
e
.
index
>
0
)
{
if
(
hasLongPressActions
)
{
typeof
longPressActions
!
.
success
===
'
function
'
&&
longPressActions
!
.
success
({
isFunction
(
longPressActions
.
success
)
&&
longPressActions
.
success
({
tapIndex
:
e
.
index
-
1
,
index
:
res
.
index
,
})
...
...
@@ -85,8 +85,8 @@ export const previewImage = <API_TYPE_PREVIEW_IMAGE>defineAsyncApi(
}
)
}
else
if
(
hasLongPressActions
)
{
typeof
longPressActions
!
.
fail
===
'
function
'
&&
longPressActions
!
.
fail
({
isFunction
(
longPressActions
.
fail
)
&&
longPressActions
.
fail
({
errMsg
:
'
showActionSheet:fail cancel
'
,
})
}
...
...
packages/uni-app-plus/src/service/api/network/downloadFile.ts
浏览文件 @
b91abffa
import
{
TEMP_PATH
}
from
'
../constants
'
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
hasOwn
,
isFunction
}
from
'
@vue/shared
'
import
{
defineTaskApi
,
API_DOWNLOAD_FILE
,
...
...
@@ -33,7 +33,7 @@ class DownloadTask implements UniApp.DownloadTask {
this
.
_downloader
.
abort
()
}
onProgressUpdate
(
callback
:
(
result
:
any
)
=>
void
)
{
if
(
typeof
callback
!==
'
function
'
)
{
if
(
!
isFunction
(
callback
)
)
{
return
}
this
.
_callbacks
.
push
(
callback
)
...
...
packages/uni-app-plus/src/service/api/network/socket.ts
浏览文件 @
b91abffa
...
...
@@ -15,7 +15,7 @@ import {
}
from
'
@dcloudio/uni-api
'
import
{
requireNativePlugin
}
from
'
../plugin/requireNativePlugin
'
import
{
base64ToArrayBuffer
,
arrayBufferToBase64
}
from
'
@dcloudio/uni-api
'
import
{
extend
,
capitalize
,
isArray
}
from
'
@vue/shared
'
import
{
extend
,
capitalize
,
isArray
,
isFunction
}
from
'
@vue/shared
'
import
{
callOptions
}
from
'
@dcloudio/uni-shared
'
type
Socket
=
{
...
...
@@ -181,7 +181,7 @@ class SocketTask implements UniApp.SocketTask {
// WYQ fix: App平台修复websocket onOpen时发送数据报错的Bug
this
.
_callbacks
[
name
].
forEach
((
callback
)
=>
{
if
(
typeof
callback
===
'
function
'
)
{
if
(
isFunction
(
callback
)
)
{
callback
(
data
)
}
})
...
...
packages/uni-app-plus/src/service/api/network/uploadFile.ts
浏览文件 @
b91abffa
...
...
@@ -5,7 +5,7 @@ import {
UploadFileProtocol
,
UploadFileOptions
,
}
from
'
@dcloudio/uni-api
'
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
hasOwn
,
isFunction
}
from
'
@vue/shared
'
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
type
Uploader
=
ReturnType
<
typeof
plus
.
uploader
.
createUpload
>
...
...
@@ -35,7 +35,7 @@ class UploadTask implements UniApp.UploadTask {
}
onProgressUpdate
(
callback
:
Function
)
{
if
(
typeof
callback
!==
'
function
'
)
{
if
(
!
isFunction
(
callback
)
)
{
return
}
this
.
_callbacks
.
push
(
callback
)
...
...
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/asset.ts
浏览文件 @
b91abffa
...
...
@@ -9,6 +9,7 @@ import { Plugin } from '../plugin'
import
{
ResolvedConfig
}
from
'
../config
'
import
{
cleanUrl
,
normalizePath
}
from
'
../utils
'
import
{
withSourcemap
}
from
'
../../../../vite/utils/utils
'
import
{
isFunction
}
from
'
@vue/shared
'
export
const
assetUrlRE
=
/__VITE_ASSET__
([
a-z
\d]{8})
__
(?:\$
_
(
.*
?)
__
)?
/g
...
...
@@ -190,7 +191,7 @@ export function assetFileNamesToFileName(
const
name
=
basename
.
slice
(
0
,
-
extname
.
length
)
const
hash
=
contentHash
if
(
typeof
assetFileNames
===
'
function
'
)
{
if
(
isFunction
(
assetFileNames
)
)
{
assetFileNames
=
assetFileNames
({
name
:
file
,
source
:
content
,
...
...
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
浏览文件 @
b91abffa
...
...
@@ -40,7 +40,7 @@ import { transform, formatMessages } from 'esbuild'
import
{
preCss
,
preNVueCss
}
from
'
../../../../preprocess
'
import
{
PAGES_JSON_JS
}
from
'
../../../../constants
'
import
{
emptyCssComments
}
from
'
../cleanString
'
import
{
isArray
}
from
'
@vue/shared
'
import
{
isArray
,
isFunction
}
from
'
@vue/shared
'
// const debug = createDebugger('vite:css')
export
interface
CSSOptions
{
...
...
@@ -530,7 +530,7 @@ async function compileCSS(
outputFileName
:
string
)
{
modules
=
_modules
if
(
modulesOptions
&&
typeof
modulesOptions
.
getJSON
===
'
function
'
)
{
if
(
modulesOptions
&&
isFunction
(
modulesOptions
.
getJSON
)
)
{
modulesOptions
.
getJSON
(
cssFileName
,
_modules
,
outputFileName
)
}
},
...
...
@@ -1395,7 +1395,7 @@ async function getSource(
):
Promise
<
{
content
:
string
;
map
?:
ExistingRawSourceMap
}
>
{
if
(
!
additionalData
)
return
{
content
:
source
}
if
(
typeof
additionalData
===
'
function
'
)
{
if
(
isFunction
(
additionalData
)
)
{
const
newContent
=
await
additionalData
(
source
,
filename
)
if
(
typeof
newContent
===
'
string
'
)
{
return
{
content
:
newContent
}
...
...
packages/uni-components/dist/components.js
浏览文件 @
b91abffa
import
{
createElementVNode
,
defineComponent
,
createVNode
,
mergeProps
,
getCurrentInstance
,
provide
,
watch
,
onUnmounted
,
shallowRef
,
reactive
,
watchEffect
,
ref
,
inject
,
onBeforeUnmount
,
computed
,
Text
as
Text$1
,
isVNode
,
Fragment
,
onMounted
,
resolveComponent
,
parseClassList
}
from
"
vue
"
;
import
{
extend
,
hasOwn
,
isPlainObject
,
isArray
}
from
"
@vue/shared
"
;
import
{
extend
,
hasOwn
,
is
Function
,
is
PlainObject
,
isArray
}
from
"
@vue/shared
"
;
import
{
cacheStringFunction
,
PRIMARY_COLOR
}
from
"
@dcloudio/uni-shared
"
;
const
OPEN_TYPES
=
[
"
navigate
"
,
...
...
@@ -272,7 +272,7 @@ function showPage({
});
page
.
addEventListener
(
"
close
"
,
onClose
);
addEventListener
(
pageId
,
(
message
)
=>
{
if
(
typeof
onMessage
===
"
function
"
)
{
if
(
isFunction
(
onMessage
)
)
{
onMessage
(
message
.
data
);
}
if
(
!
message
.
keep
)
{
...
...
@@ -988,7 +988,7 @@ function useTouchtrack(method) {
}
function
addListener
(
type
,
callback2
)
{
__event
[
type
]
=
function
(
$event
)
{
if
(
typeof
callback2
===
"
function
"
)
{
if
(
isFunction
(
callback2
)
)
{
$event
.
touches
=
$event
.
changedTouches
;
if
(
callback2
(
$event
)
===
false
)
{
$event
.
stopPropagation
();
...
...
packages/uni-components/src/helpers/scroller/Scroller.ts
浏览文件 @
b91abffa
import
{
isFunction
}
from
'
@vue/shared
'
import
{
Friction
}
from
'
./Friction
'
import
{
Spring
}
from
'
./Spring
'
import
{
Scroll
}
from
'
./Scroll
'
...
...
@@ -233,7 +234,7 @@ export class Scroller {
this
.
_position
=
c
this
.
updatePosition
()
}
if
(
typeof
this
.
_options
.
onSnap
===
'
function
'
)
{
if
(
isFunction
(
this
.
_options
.
onSnap
)
)
{
this
.
_options
.
onSnap
(
Math
.
floor
(
Math
.
abs
(
this
.
_position
)
/
this
.
_itemSize
)
)
...
...
@@ -265,7 +266,7 @@ export class Scroller {
if
(
this
.
_position
!==
i
)
{
this
.
_snapping
=
true
this
.
scrollTo
(
-
i
)
if
(
typeof
this
.
_options
.
onSnap
===
'
function
'
)
{
if
(
isFunction
(
this
.
_options
.
onSnap
)
)
{
this
.
_options
.
onSnap
(
Math
.
floor
(
Math
.
abs
(
this
.
_position
)
/
this
.
_itemSize
)
)
...
...
@@ -295,7 +296,7 @@ export class Scroller {
}
dispatchScroll
()
{
if
(
typeof
this
.
_options
.
onScroll
===
'
function
'
&&
isFunction
(
this
.
_options
.
onScroll
)
&&
Math
.
round
(
Number
(
this
.
_lastPos
))
!==
Math
.
round
(
this
.
_position
)
)
{
this
.
_lastPos
=
this
.
_position
...
...
@@ -342,7 +343,7 @@ export class Scroller {
this
.
updatePosition
()
if
(
position
!==
this
.
_position
)
{
this
.
dispatchScroll
()
if
(
typeof
this
.
_options
.
onSnap
===
'
function
'
)
{
if
(
isFunction
(
this
.
_options
.
onSnap
)
)
{
this
.
_options
.
onSnap
(
Math
.
floor
(
Math
.
abs
(
this
.
_position
)
/
this
.
_itemSize
)
)
...
...
packages/uni-components/src/helpers/useField.ts
浏览文件 @
b91abffa
...
...
@@ -9,7 +9,7 @@ import {
reactive
,
nextTick
,
}
from
'
vue
'
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isFunction
}
from
'
@vue/shared
'
import
{
debounce
}
from
'
@dcloudio/uni-shared
'
import
{
getCurrentPageId
,
registerViewMethod
}
from
'
@dcloudio/uni-core
'
import
{
throttle
}
from
'
./throttle
'
...
...
@@ -371,10 +371,7 @@ function useEvent(
}
const
onInput
=
function
(
event
:
Event
,
force
?:
boolean
)
{
event
.
stopPropagation
()
if
(
typeof
beforeInput
===
'
function
'
&&
beforeInput
(
event
,
state
)
===
false
)
{
if
(
isFunction
(
beforeInput
)
&&
beforeInput
(
event
,
state
)
===
false
)
{
return
}
state
.
value
=
field
.
value
...
...
packages/uni-components/src/helpers/useTouchtrack.ts
浏览文件 @
b91abffa
import
{
onBeforeUnmount
}
from
'
vue
'
import
{
isFunction
}
from
'
@vue/shared
'
const
addListenerToElement
=
function
(
element
:
HTMLElement
,
...
...
@@ -10,7 +11,7 @@ const addListenerToElement = function (
element
.
addEventListener
(
type
,
(
$event
:
Event
)
=>
{
if
(
typeof
callback
===
'
function
'
)
{
if
(
isFunction
(
callback
)
)
{
if
(
callback
(
$event
)
===
false
)
{
if
(
typeof
$event
.
cancelable
!==
'
undefined
'
?
$event
.
cancelable
:
true
...
...
packages/uni-components/src/nvue/helpers/common.ts
浏览文件 @
b91abffa
...
...
@@ -26,7 +26,3 @@ export const firstLetterToLowerCase = cached((str: string) => {
export
function
isDef
(
v
:
any
)
{
return
typeof
v
!==
'
undefined
'
}
export
function
isFn
(
fn
:
any
)
{
return
typeof
fn
===
'
function
'
}
packages/uni-components/src/nvue/movable-view/useTouchtrack.ts
浏览文件 @
b91abffa
import
{
isFunction
}
from
'
@vue/shared
'
type
State
=
'
start
'
|
'
move
'
|
'
end
'
|
'
cancel
'
type
TouchOrMouseEvent
=
TouchEvent
|
MouseEvent
type
Detail
=
{
...
...
@@ -32,7 +33,7 @@ export function useTouchtrack(
}
function
addListener
(
type
:
CallbackType
,
callback
:
Function
)
{
__event
[
type
]
=
function
(
$event
:
TouchtrackEvent
)
{
if
(
typeof
callback
===
'
function
'
)
{
if
(
isFunction
(
callback
)
)
{
$event
.
touches
=
$event
.
changedTouches
if
(
callback
(
$event
)
===
false
)
{
$event
.
stopPropagation
()
...
...
packages/uni-components/src/vue/canvas/index.tsx
浏览文件 @
b91abffa
import
{
ref
,
computed
,
ExtractPropTypes
,
Ref
,
onMounted
}
from
'
vue
'
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isFunction
}
from
'
@vue/shared
'
import
type
{
Actions
,
OperateCanvasType
}
from
'
@dcloudio/uni-api
'
import
{
useAttrs
,
...
...
@@ -698,7 +698,7 @@ function useMethods(
resolve
:
(
res
:
{
callbackId
:
number
;
data
:
any
})
=>
void
)
{
let
method
=
methods
[
type
]
if
(
type
.
indexOf
(
'
_
'
)
!==
0
&&
typeof
method
===
'
function
'
)
{
if
(
type
.
indexOf
(
'
_
'
)
!==
0
&&
isFunction
(
method
)
)
{
method
(
data
as
any
,
resolve
)
}
}
...
...
packages/uni-core/src/helpers/showPage.ts
浏览文件 @
b91abffa
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isFunction
}
from
'
@vue/shared
'
declare
interface
BroadcastChannel
{
new
(
id
:
string
):
BroadcastChannel
...
...
@@ -157,7 +157,7 @@ export function showPage({
})
page
.
addEventListener
(
'
close
'
,
onClose
)
addEventListener
(
pageId
,
(
message
)
=>
{
if
(
typeof
onMessage
===
'
function
'
)
{
if
(
isFunction
(
onMessage
)
)
{
onMessage
(
message
.
data
)
}
if
(
!
message
.
keep
)
{
...
...
packages/uni-h5-vite/src/plugins/css.ts
浏览文件 @
b91abffa
...
...
@@ -11,6 +11,7 @@ import {
isExternalUrl
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
OutputOptions
}
from
'
rollup
'
import
{
isFunction
}
from
'
@vue/shared
'
function
isCombineBuiltInCss
(
config
:
ResolvedConfig
)
{
return
config
.
command
===
'
build
'
&&
config
.
build
.
cssCodeSplit
...
...
@@ -126,7 +127,7 @@ export function assetFileNamesToFileName(
const
name
=
basename
.
slice
(
0
,
-
extname
.
length
)
const
hash
=
contentHash
if
(
typeof
assetFileNames
===
'
function
'
)
{
if
(
isFunction
(
assetFileNames
)
)
{
assetFileNames
=
assetFileNames
({
name
:
file
,
source
:
content
,
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
b91abffa
...
...
@@ -2107,7 +2107,7 @@ function useMethods(props2, canvasRef, actionsWaiting) {
};
function
_handleSubscribe
(
type
,
data
,
resolve
)
{
let
method
=
methods
[
type
];
if
(
type
.
indexOf
(
"
_
"
)
!==
0
&&
typeof
method
===
"
function
"
)
{
if
(
type
.
indexOf
(
"
_
"
)
!==
0
&&
shared
.
isFunction
(
method
)
)
{
method
(
data
,
resolve
);
}
}
...
...
@@ -3057,7 +3057,7 @@ function useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput) {
};
const
onInput
=
function
(
event
,
force
)
{
event
.
stopPropagation
();
if
(
typeof
beforeInput
===
"
function
"
&&
beforeInput
(
event
,
state
)
===
false
)
{
if
(
shared
.
isFunction
(
beforeInput
)
&&
beforeInput
(
event
,
state
)
===
false
)
{
return
;
}
state
.
value
=
field
.
value
;
...
...
@@ -8164,7 +8164,7 @@ var MapMarker = /* @__PURE__ */ defineSystemComponent({
callout
.
setPosition
(
b
);
}
const
cb
=
data
.
animationEnd
;
if
(
typeof
cb
===
"
function
"
)
{
if
(
shared
.
isFunction
(
cb
)
)
{
cb
();
}
});
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
b91abffa
...
...
@@ -4313,11 +4313,11 @@ class SelectorQuery {
convertContext(result);
}
const queueCb = queueCbs[index2];
if (
typeof queueCb === "function"
) {
if (
isFunction(queueCb)
) {
queueCb.call(this, result);
}
});
if (
typeof callback === "function"
) {
if (
isFunction(callback)
) {
callback.call(this, res);
}
});
...
...
@@ -7002,7 +7002,7 @@ function useMethods(props2, canvasRef, actionsWaiting) {
};
function _handleSubscribe(type, data, resolve) {
let method = methods[type];
if (type.indexOf("_") !== 0 &&
typeof method === "function"
) {
if (type.indexOf("_") !== 0 &&
isFunction(method)
) {
method(data, resolve);
}
}
...
...
@@ -8642,7 +8642,7 @@ function useEvent(fieldRef, state2, props2, trigger, triggerInput, beforeInput)
};
const onInput = function(event, force) {
event.stopPropagation();
if (
typeof beforeInput === "function"
&& beforeInput(event, state2) === false) {
if (
isFunction(beforeInput)
&& beforeInput(event, state2) === false) {
return;
}
state2.value = field.value;
...
...
@@ -9120,7 +9120,7 @@ function useMovableAreaState(props2, rootRef) {
}
const addListenerToElement = function(element, type, callback, capture) {
element.addEventListener(type, ($event) => {
if (
typeof callback === "function"
) {
if (
isFunction(callback)
) {
if (callback($event) === false) {
if (typeof $event.cancelable !== "undefined" ? $event.cancelable : true) {
$event.preventDefault();
...
...
@@ -10903,7 +10903,7 @@ class Scroller {
this._position = c;
this.updatePosition();
}
if (
typeof this._options.onSnap === "function"
) {
if (
isFunction(this._options.onSnap)
) {
this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize));
}
}
...
...
@@ -10929,7 +10929,7 @@ class Scroller {
if (this._position !== i) {
this._snapping = true;
this.scrollTo(-i);
if (
typeof this._options.onSnap === "function"
) {
if (
isFunction(this._options.onSnap)
) {
this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize));
}
}
...
...
@@ -10956,7 +10956,7 @@ class Scroller {
this._element.addEventListener("transitionend", this._onTransitionEnd);
}
dispatchScroll() {
if (
typeof this._options.onScroll === "function"
&& Math.round(Number(this._lastPos)) !== Math.round(this._position)) {
if (
isFunction(this._options.onScroll)
&& Math.round(Number(this._lastPos)) !== Math.round(this._position)) {
this._lastPos = this._position;
const event = {
target: {
...
...
@@ -10995,7 +10995,7 @@ class Scroller {
this.updatePosition();
if (position !== this._position) {
this.dispatchScroll();
if (
typeof this._options.onSnap === "function"
) {
if (
isFunction(this._options.onSnap)
) {
this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize));
}
}
...
...
@@ -15808,7 +15808,7 @@ var MapMarker = /* @__PURE__ */ defineSystemComponent({
callout.setPosition(b);
}
const cb = data.animationEnd;
if (
typeof cb === "function"
) {
if (
isFunction(cb)
) {
cb();
}
});
...
...
@@ -16162,7 +16162,7 @@ var MapControl = /* @__PURE__ */ defineSystemComponent({
const initInnerAudioContextEventOnce = /* @__PURE__ */ once(() => {
innerAudioContextEventNames.forEach((eventName) => {
InnerAudioContext.prototype[eventName] = function(callback) {
if (
typeof callback === "function"
) {
if (
isFunction(callback)
) {
this._events[eventName].push(callback);
}
};
...
...
@@ -16380,7 +16380,7 @@ function getBrowserInfo() {
model = "iPad";
osname = "iOS";
deviceType = "pad";
osversion =
typeof window.BigInt === "function"
? "14.0" : "13.0";
osversion =
isFunction(window.BigInt)
? "14.0" : "13.0";
} else if (isWindows || isMac || isLinux) {
model = "PC";
osname = "PC";
...
...
@@ -17773,7 +17773,7 @@ class DownloadTask {
this._xhr = xhr;
}
onProgressUpdate(callback) {
if (
typeof callback !== "function"
) {
if (
!isFunction(callback)
) {
return;
}
this._callbacks.push(callback);
...
...
@@ -17858,7 +17858,7 @@ class UploadTask {
this._xhr = xhr;
}
onProgressUpdate(callback) {
if (
typeof callback !== "function"
) {
if (
!isFunction(callback)
) {
return;
}
this._callbacks.push(callback);
...
...
@@ -18083,7 +18083,7 @@ const connectSocket = /* @__PURE__ */ defineTaskApi(API_CONNECT_SOCKET, ({ url,
}, ConnectSocketProtocol, ConnectSocketOptions);
function callSocketTask(socketTask, method, option, resolve, reject) {
const fn = socketTask[method];
if (
typeof fn === "function"
) {
if (
isFunction(fn)
) {
fn.call(socketTask, extend({}, option, {
success() {
resolve();
...
...
@@ -18133,19 +18133,19 @@ function getJSONP(url, options, success, error) {
js.remove();
}
window[callbackName] = (res) => {
if (
typeof success === "function"
) {
if (
isFunction(success)
) {
success(res);
}
end();
};
js.onerror = () => {
if (
typeof error === "function"
) {
if (
isFunction(error)
) {
error();
}
end();
};
timing = setTimeout(function() {
if (
typeof error === "function"
) {
if (
isFunction(error)
) {
error();
}
end();
...
...
packages/uni-h5/src/helpers/getJSONP.ts
浏览文件 @
b91abffa
import
{
isFunction
}
from
'
@vue/shared
'
interface
Options
{
callback
?:
string
timeout
?:
number
...
...
@@ -20,19 +21,19 @@ export function getJSONP(
js
.
remove
()
}
;(
window
as
any
)[
callbackName
]
=
(
res
:
any
)
=>
{
if
(
typeof
success
===
'
function
'
)
{
if
(
isFunction
(
success
)
)
{
success
(
res
)
}
end
()
}
js
.
onerror
=
()
=>
{
if
(
typeof
error
===
'
function
'
)
{
if
(
isFunction
(
error
)
)
{
error
()
}
end
()
}
timing
=
setTimeout
(
function
()
{
if
(
typeof
error
===
'
function
'
)
{
if
(
isFunction
(
error
)
)
{
error
()
}
end
()
...
...
packages/uni-h5/src/service/api/base/getBrowserInfo.ts
浏览文件 @
b91abffa
import
{
isFunction
}
from
'
@vue/shared
'
import
{
ua
,
isIOS
,
...
...
@@ -94,7 +95,7 @@ export function getBrowserInfo() {
model
=
'
iPad
'
osname
=
'
iOS
'
deviceType
=
'
pad
'
osversion
=
typeof
window
.
BigInt
===
'
function
'
?
'
14.0
'
:
'
13.0
'
osversion
=
isFunction
(
window
.
BigInt
)
?
'
14.0
'
:
'
13.0
'
}
else
if
(
isWindows
||
isMac
||
isLinux
)
{
model
=
'
PC
'
osname
=
'
PC
'
...
...
packages/uni-h5/src/service/api/context/createInnerAudioContext.ts
浏览文件 @
b91abffa
import
{
isFunction
}
from
'
@vue/shared
'
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
import
{
API_CREATE_INNER_AUDIO_CONTEXT
,
...
...
@@ -28,7 +29,7 @@ const initInnerAudioContextEventOnce = /*#__PURE__*/ once(() => {
// 批量设置音频上下文事件监听方法
innerAudioContextEventNames
.
forEach
((
eventName
)
=>
{
InnerAudioContext
.
prototype
[
eventName
]
=
function
(
callback
:
Function
)
{
if
(
typeof
callback
===
'
function
'
)
{
if
(
isFunction
(
callback
)
)
{
this
.
_events
[
eventName
]
!
.
push
(
callback
)
}
}
...
...
packages/uni-h5/src/service/api/network/downloadFile.ts
浏览文件 @
b91abffa
import
{
fileToUrl
,
getFileName
}
from
'
../../../helpers/file
'
import
{
isFunction
}
from
'
@vue/shared
'
import
{
defineTaskApi
,
API_DOWNLOAD_FILE
,
...
...
@@ -6,6 +6,7 @@ import {
DownloadFileProtocol
,
DownloadFileOptions
,
}
from
'
@dcloudio/uni-api
'
import
{
fileToUrl
,
getFileName
}
from
'
../../../helpers/file
'
/**
* 下载任务
*/
...
...
@@ -21,7 +22,7 @@ class DownloadTask implements UniApp.DownloadTask {
* @param {Function} callback 回调
*/
onProgressUpdate
(
callback
:
(
result
:
any
)
=>
void
)
{
if
(
typeof
callback
!==
'
function
'
)
{
if
(
!
isFunction
(
callback
)
)
{
return
}
this
.
_callbacks
.
push
(
callback
)
...
...
packages/uni-h5/src/service/api/network/socket.ts
浏览文件 @
b91abffa
import
{
extend
,
capitalize
}
from
'
@vue/shared
'
import
{
extend
,
capitalize
,
isFunction
}
from
'
@vue/shared
'
import
{
defineTaskApi
,
defineAsyncApi
,
...
...
@@ -185,7 +185,7 @@ function callSocketTask(
reject
:
Function
)
{
const
fn
=
socketTask
[
method
]
if
(
typeof
fn
===
'
function
'
)
{
if
(
isFunction
(
fn
)
)
{
fn
.
call
(
socketTask
,
extend
({},
option
,
{
...
...
packages/uni-h5/src/service/api/network/uploadFile.ts
浏览文件 @
b91abffa
import
{
isArray
}
from
'
@vue/shared
'
import
{
isArray
,
isFunction
}
from
'
@vue/shared
'
import
{
defineTaskApi
,
...
...
@@ -24,7 +24,7 @@ class UploadTask implements UniApp.UploadTask {
* @param callback 回调
*/
onProgressUpdate
(
callback
:
(
result
:
any
)
=>
void
)
{
if
(
typeof
callback
!==
'
function
'
)
{
if
(
!
isFunction
(
callback
)
)
{
return
}
this
.
_callbacks
.
push
(
callback
)
...
...
packages/uni-h5/src/view/components/map/MapMarker.tsx
浏览文件 @
b91abffa
import
{
onUnmounted
,
inject
,
watch
}
from
'
vue
'
import
{
isFunction
}
from
'
@vue/shared
'
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
import
{
defineSystemComponent
,
useCustomEvent
}
from
'
@dcloudio/uni-components
'
import
{
Maps
,
Map
,
LatLng
,
Callout
,
CalloutOptions
}
from
'
./maps
'
...
...
@@ -400,7 +401,7 @@ export default /*#__PURE__*/ defineSystemComponent({
callout
.
setPosition
(
b
)
}
const
cb
=
data
.
animationEnd
if
(
typeof
cb
===
'
function
'
)
{
if
(
isFunction
(
cb
)
)
{
cb
()
}
})
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
b91abffa
...
...
@@ -379,16 +379,16 @@ function callOptions(options, data) {
};
}
if
(
/:ok$/
.
test
(
data
.
errMsg
))
{
if
(
typeof
options
.
success
===
'
function
'
)
{
if
(
shared
.
isFunction
(
options
.
success
)
)
{
options
.
success
(
data
);
}
}
else
{
if
(
typeof
options
.
fail
===
'
function
'
)
{
if
(
shared
.
isFunction
(
options
.
fail
)
)
{
options
.
fail
(
data
);
}
}
if
(
typeof
options
.
complete
===
'
function
'
)
{
if
(
shared
.
isFunction
(
options
.
complete
)
)
{
options
.
complete
(
data
);
}
}
...
...
@@ -724,7 +724,7 @@ function parseNVueDataset(attr) {
}
function
plusReady
(
callback
)
{
if
(
typeof
callback
!==
'
function
'
)
{
if
(
!
shared
.
isFunction
(
callback
)
)
{
return
;
}
if
(
window
.
plus
)
{
...
...
@@ -1203,10 +1203,6 @@ const ACTION_TYPE_EVENT = 20;
/**
* 需要手动传入 timer,主要是解决 App 平台的定制 timer
* @param fn
* @param delay
* @param timer
* @returns
*/
function
debounce
(
fn
,
delay
,
{
clearTimeout
,
setTimeout
})
{
let
timeout
;
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
b91abffa
...
...
@@ -131,10 +131,6 @@ export declare const DATA_RE: RegExp;
/**
* 需要手动传入 timer,主要是解决 App 平台的定制 timer
* @param fn
* @param delay
* @param timer
* @returns
*/
export
declare
function
debounce
(
fn
:
Function
,
delay
:
number
,
{
clearTimeout
,
setTimeout
}:
Timer
):
{
(
this
:
any
):
void
;
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
b91abffa
import
{
isHTMLTag
,
isSVGTag
,
hyphenate
,
camelize
,
isString
,
isPlainObject
,
extend
,
isArray
,
toTypeString
,
toRawType
,
capitalize
}
from
'
@vue/shared
'
;
import
{
isHTMLTag
,
isSVGTag
,
hyphenate
,
camelize
,
is
Function
,
is
String
,
isPlainObject
,
extend
,
isArray
,
toTypeString
,
toRawType
,
capitalize
}
from
'
@vue/shared
'
;
const
BUILT_IN_TAG_NAMES
=
[
'
ad
'
,
...
...
@@ -375,16 +375,16 @@ function callOptions(options, data) {
};
}
if
(
/:ok$/
.
test
(
data
.
errMsg
))
{
if
(
typeof
options
.
success
===
'
function
'
)
{
if
(
isFunction
(
options
.
success
)
)
{
options
.
success
(
data
);
}
}
else
{
if
(
typeof
options
.
fail
===
'
function
'
)
{
if
(
isFunction
(
options
.
fail
)
)
{
options
.
fail
(
data
);
}
}
if
(
typeof
options
.
complete
===
'
function
'
)
{
if
(
isFunction
(
options
.
complete
)
)
{
options
.
complete
(
data
);
}
}
...
...
@@ -720,7 +720,7 @@ function parseNVueDataset(attr) {
}
function
plusReady
(
callback
)
{
if
(
typeof
callback
!==
'
function
'
)
{
if
(
!
isFunction
(
callback
)
)
{
return
;
}
if
(
window
.
plus
)
{
...
...
@@ -1199,10 +1199,6 @@ const ACTION_TYPE_EVENT = 20;
/**
* 需要手动传入 timer,主要是解决 App 平台的定制 timer
* @param fn
* @param delay
* @param timer
* @returns
*/
function
debounce
(
fn
,
delay
,
{
clearTimeout
,
setTimeout
})
{
let
timeout
;
...
...
packages/uni-shared/src/debounce.ts
浏览文件 @
b91abffa
...
...
@@ -4,10 +4,6 @@ interface Timer {
}
/**
* 需要手动传入 timer,主要是解决 App 平台的定制 timer
* @param fn
* @param delay
* @param timer
* @returns
*/
export
function
debounce
(
fn
:
Function
,
...
...
packages/uni-shared/src/plus.ts
浏览文件 @
b91abffa
import
{
isFunction
}
from
'
@vue/shared
'
export
function
plusReady
(
callback
:
()
=>
void
)
{
if
(
typeof
callback
!==
'
function
'
)
{
if
(
!
isFunction
(
callback
)
)
{
return
}
if
((
window
as
any
).
plus
)
{
...
...
packages/uni-shared/src/utils.ts
浏览文件 @
b91abffa
import
{
isPlainObject
,
isString
}
from
'
@vue/shared
'
import
{
is
Function
,
is
PlainObject
,
isString
}
from
'
@vue/shared
'
export
function
cache
<
T
>
(
fn
:
(
str
:
string
)
=>
T
)
{
const
cache
:
Record
<
string
,
T
>
=
Object
.
create
(
null
)
...
...
@@ -101,15 +101,15 @@ export function callOptions(
}
}
if
(
/:ok$/
.
test
(
data
.
errMsg
))
{
if
(
typeof
options
.
success
===
'
function
'
)
{
if
(
isFunction
(
options
.
success
)
)
{
options
.
success
(
data
)
}
}
else
{
if
(
typeof
options
.
fail
===
'
function
'
)
{
if
(
isFunction
(
options
.
fail
)
)
{
options
.
fail
(
data
)
}
}
if
(
typeof
options
.
complete
===
'
function
'
)
{
if
(
isFunction
(
options
.
complete
)
)
{
options
.
complete
(
data
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录