Skip to content

Commit

Permalink
feat(runtime-web): caniuse 函数增加部分能力判断 (#71)
Browse files Browse the repository at this point in the history
* feat(runtime-web): caniuse 函数增加部分能力判断

* feat(runtime-web): can-i-use 实现移除不必要的判断
  • Loading branch information
hwaphon authored Jul 6, 2023
1 parent 6a4e992 commit a45cd02
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/runtime-web/src/api/base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
type IAnyFunc = (...args: unknown[]) => any

const CAN_I_USE_FALSY = [
'component.observers',
'component.relations',
'component.externalClass',
'component.lifetimes'
]

export default function generateBaseAPI(api: Record<string, any>) {
return {
call(
Expand All @@ -20,8 +27,11 @@ export default function generateBaseAPI(api: Record<string, any>) {
})
},

canIUse() {
canIUse(param = '') {
console.warn('canIUse API 目前还未完全实现,仅供参考')

if (CAN_I_USE_FALSY.indexOf(param) > -1) return false

return true
},

Expand Down

0 comments on commit a45cd02

Please sign in to comment.