Skip to content

Commit

Permalink
去掉无用的添加
Browse files Browse the repository at this point in the history
  • Loading branch information
wangcuijuan committed Dec 19, 2024
1 parent 0099299 commit 9592597
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 36 deletions.
2 changes: 1 addition & 1 deletion examples/mpx-webview/H5/webviewbridge.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions packages/webview-bridge/dist/webviewbridge.esm.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ const webviewBridge = {
};

function postMessage (type, ...extraData) {
let data = extraData[0] || {};
if (type === 'invoke') {
data = extraData[1] || {};
type = extraData[0];
extraData = extraData.slice(1);
}
const data = extraData[0];
if (type !== 'getEnv') {
const currentCallbackId = ++callbackId;
callbacks[currentCallbackId] = (err, res) => {
Expand All @@ -160,7 +161,7 @@ function postMessage (type, ...extraData) {
const postParams = {
type,
callbackId,
payload: type === 'invoke' ? extraData : data
args: extraData
};
if (clientUid !== undefined) {
postParams.clientUid = clientUid;
Expand Down Expand Up @@ -188,8 +189,7 @@ const getWebviewApi = () => {
'reLaunch',
'redirectTo',
'postMessage',
'getEnv',
'invoke'
'getEnv'
]
},
tt: {
Expand All @@ -210,8 +210,7 @@ const getWebviewApi = () => {
'uploadFile',
'getNetworkType',
'openLocation',
'getLocation',
'invoke'
'getLocation'
]
},
swan: {
Expand All @@ -223,8 +222,7 @@ const getWebviewApi = () => {
'reLaunch',
'redirectTo',
'getEnv',
'postMessage',
'invoke'
'postMessage'
]
},
qq: {
Expand All @@ -236,8 +234,7 @@ const getWebviewApi = () => {
'reLaunch',
'redirectTo',
'getEnv',
'postMessage',
'invoke'
'postMessage'
]
}
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9592597

Please sign in to comment.