提交 0da4fbd7 编写于 作者: fxy060608's avatar fxy060608

chore: update wx

上级 570d7b6d
......@@ -10,7 +10,12 @@ const objectKeys = [
'worklet',
]
const oldWx = globalThis[['w', 'x'].join('')]
const target = typeof globalThis !== 'undefined' ? globalThis : (function() {
return this
})()
const key = ['w', 'x'].join('')
const oldWx = target[key]
function isWxKey(key) {
return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function'
......@@ -18,14 +23,13 @@ function isWxKey(key) {
function initWx() {
const newWx = {}
for (const key in oldWx) {
if (isWxKey(key)) {
// TODO wrapper function
newWx[key] = oldWx[key]
}
for (const key in oldWx) {
if (isWxKey(key)) {
// TODO wrapper function
newWx[key] = oldWx[key]
}
return newWx
}
return newWx
}
const wxProxy = initWx()
globalThis[['w', 'x'].join('')] = wxProxy
export default wxProxy
target[key] = initWx()
export default target[key]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册