yach.open.jssdk 4.3.7 → 4.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/yach_jssdk_4.3.8.js +1 -0
- package/es/api/app/custom/talYoungFilesUpload.js +2 -0
- package/es/api/biz/chat/chooseConversationByCorpId.js +2 -0
- package/es/api/biz/chat/openSingleChat.js +2 -0
- package/es/api/biz/chat/openSquad.js +2 -0
- package/es/api/biz/chat/openTeamChat.js +2 -0
- package/es/api/biz/chat/pickConversation.js +2 -0
- package/es/api/biz/chat/sendP2PMsg.js +2 -0
- package/es/api/biz/contact/complexPicker.js +2 -0
- package/es/api/biz/contact/departmentsPicker.js +2 -0
- package/es/api/biz/group/groupComplexPicker.js +2 -0
- package/es/api/biz/map/multipointView.js +2 -0
- package/es/api/biz/map/view.js +2 -0
- package/es/api/biz/navigation/close.js +2 -0
- package/es/api/biz/navigation/goBack.js +2 -0
- package/es/api/biz/navigation/quit.js +2 -0
- package/es/api/biz/navigation/replace.js +2 -0
- package/es/api/biz/navigation/setIcon.js +2 -0
- package/es/api/biz/navigation/setLeft.js +2 -0
- package/es/api/biz/navigation/setMenu.js +2 -0
- package/es/api/biz/navigation/setPanGestureEnable.js +2 -0
- package/es/api/biz/navigation/setRight.js +2 -0
- package/es/api/biz/navigation/setTitle.js +2 -0
- package/es/api/biz/navigation/setTitleExpandIcon.js +2 -0
- package/es/api/biz/navigation/setWindowBig.js +2 -0
- package/es/api/biz/navigation/tencentMeeting.js +2 -0
- package/es/api/biz/navigation/tencentMeetingBegin.js +2 -0
- package/es/api/biz/navigation/updateExpandTitle.js +2 -0
- package/es/api/biz/telephone/call.js +2 -0
- package/es/api/biz/telephone/showCallMenu.js +2 -0
- package/es/api/biz/util/addAppToNav.js +2 -0
- package/es/api/biz/util/assistantCreate.js +2 -0
- package/es/api/biz/util/authFinish.js +2 -0
- package/es/api/biz/util/authStart.js +2 -0
- package/es/api/biz/util/chosen.js +2 -0
- package/es/api/biz/util/clipboardFileUpload.js +2 -0
- package/es/api/biz/util/closeWindow.js +2 -0
- package/es/api/biz/util/complain.js +2 -0
- package/es/api/biz/util/createModifySchedule.js +2 -0
- package/es/api/biz/util/datepicker.js +2 -0
- package/es/api/biz/util/datetimepicker.js +2 -0
- package/es/api/biz/util/disableScreenCapture.js +2 -0
- package/es/api/biz/util/downloadFile.js +2 -0
- package/es/api/biz/util/entergroupCheck.js +2 -0
- package/es/api/biz/util/externalLinkPreviewFile.js +2 -0
- package/es/api/biz/util/feedback.js +2 -0
- package/es/api/biz/util/getSingleWebviewData.js +2 -0
- package/es/api/biz/util/getTogetherConfig.js +2 -0
- package/es/api/biz/util/getToken.js +2 -0
- package/es/api/biz/util/injectScript.js +2 -0
- package/es/api/biz/util/invoice.js +2 -0
- package/es/api/biz/util/mediaFileUpload.js +2 -0
- package/es/api/biz/util/onlineDocmentOpenTeamChat.js +2 -0
- package/es/api/biz/util/open.js +2 -0
- package/es/api/biz/util/openFutureGroup.js +2 -0
- package/es/api/biz/util/openLink.js +2 -0
- package/es/api/biz/util/openMediaFileDialog.js +2 -0
- package/es/api/biz/util/openSingleWebview.js +2 -0
- package/es/api/biz/util/openSlidePanel.js +2 -0
- package/es/api/biz/util/openTalYoungToTopic.js +2 -0
- package/es/api/biz/util/openTogetherEyeWebview.js +2 -0
- package/es/api/biz/util/openUserSchedule.js +2 -0
- package/es/api/biz/util/openVideoPlayer.js +2 -0
- package/es/api/biz/util/previewFile.js +2 -0
- package/es/api/biz/util/previewImage.js +2 -0
- package/es/api/biz/util/proxy.js +2 -0
- package/es/api/biz/util/pushWorkMsg.js +2 -0
- package/es/api/biz/util/remind.js +2 -0
- package/es/api/biz/util/resetSessionUnread.js +2 -0
- package/es/api/biz/util/rouseApp.js +2 -0
- package/es/api/biz/util/savePic.js +2 -0
- package/es/api/biz/util/scan.js +2 -0
- package/es/api/biz/util/selectDepartment.js +2 -0
- package/es/api/biz/util/share.js +2 -0
- package/es/api/biz/util/takePicture.js +2 -0
- package/es/api/biz/util/uploadAttachment.js +2 -0
- package/es/api/biz/util/yachEvent.js +2 -0
- package/es/api/biz/util/zfbAuth.js +2 -0
- package/es/api/biz/webViewMessage/send.js +2 -0
- package/es/api/device/audio/download.js +2 -0
- package/es/api/device/audio/onPlayEnd.js +2 -0
- package/es/api/device/audio/onRecordEnd.js +2 -0
- package/es/api/device/audio/onRecordEnd_v2.js +2 -0
- package/es/api/device/audio/pause.js +2 -0
- package/es/api/device/audio/play.js +2 -0
- package/es/api/device/audio/resume.js +2 -0
- package/es/api/device/audio/startRecord.js +2 -0
- package/es/api/device/audio/startRecord_v2.js +2 -0
- package/es/api/device/audio/stop.js +2 -0
- package/es/api/device/audio/stopRecord.js +2 -0
- package/es/api/device/audio/stopRecord_v2.js +2 -0
- package/es/api/device/base/checkStepPermission.js +2 -0
- package/es/api/device/base/getPhoneInfo.js +2 -0
- package/es/api/device/base/getUUID.js +2 -0
- package/es/api/device/connection/getNetworkType.js +2 -0
- package/es/api/device/connection/isAtTal.js +4 -2
- package/es/api/device/geolocation/get.js +2 -0
- package/es/api/device/geolocation/getSwitch.js +2 -0
- package/es/api/device/notification/actionSheet.js +2 -0
- package/es/api/device/notification/alert.js +2 -0
- package/es/api/device/notification/confirm.js +2 -0
- package/es/api/device/notification/hidePreloader.js +2 -0
- package/es/api/device/notification/showPreloader.js +2 -0
- package/es/api/device/notification/toast.js +2 -0
- package/es/api/device/notification/vibrate.js +2 -0
- package/es/api/device/system/getLang.js +2 -0
- package/es/api/device/system/setLight.js +2 -0
- package/es/api/initAPI.js +5 -3
- package/es/api/primary/createTab.js +2 -0
- package/es/api/primary/exitFullScreen.js +2 -0
- package/es/api/primary/fullScreen.js +2 -0
- package/es/api/primary/weeklyShare.js +2 -0
- package/es/api/runtime/permission/requestAuthCode.js +2 -0
- package/es/api/ui/pullToRefresh/disable.js +2 -0
- package/es/api/ui/pullToRefresh/enable.js +2 -0
- package/es/api/ui/pullToRefresh/stop.js +2 -0
- package/es/api/ui/webViewBounce/disable.js +2 -0
- package/es/api/util/domainStorage/getItem.js +2 -0
- package/es/api/util/domainStorage/removeItem.js +2 -0
- package/es/api/util/domainStorage/setItem.js +2 -0
- package/es/api/util/tool/flushLog.js +2 -0
- package/es/api/util/tool/log.js +2 -0
- package/es/index.js +25 -14
- package/es/lib/bridge/mobile.js +24 -8
- package/es/lib/bridge/pc.js +16 -8
- package/es/lib/helper/apiHelper.js +2 -0
- package/es/lib/helper/codeMap.js +2 -0
- package/es/lib/helper/event.js +13 -0
- package/es/lib/helper/pcIframe.js +45 -14
- package/es/lib/index.js +21 -7
- package/es/lib/sdk/index.js +35 -14
- package/es/lib/sdk/sdk.typings.js +1 -0
- package/es/utils/bpitLog.js +13 -4
- package/es/utils/compareVersions.js +50 -23
- package/es/utils/console.d.ts +1 -1
- package/es/utils/console.js +17 -2
- package/es/utils/env.js +19 -12
- package/es/utils/index.js +5 -0
- package/libs/api/app/custom/talYoungFilesUpload.js +6 -1
- package/libs/api/biz/chat/chooseConversationByCorpId.js +6 -0
- package/libs/api/biz/chat/openSingleChat.js +6 -0
- package/libs/api/biz/chat/openSquad.js +6 -0
- package/libs/api/biz/chat/openTeamChat.js +6 -0
- package/libs/api/biz/chat/pickConversation.js +6 -0
- package/libs/api/biz/chat/sendP2PMsg.js +6 -0
- package/libs/api/biz/contact/complexPicker.js +6 -0
- package/libs/api/biz/contact/departmentsPicker.js +6 -0
- package/libs/api/biz/group/groupComplexPicker.js +6 -0
- package/libs/api/biz/map/multipointView.js +6 -0
- package/libs/api/biz/map/view.js +6 -0
- package/libs/api/biz/navigation/close.js +6 -0
- package/libs/api/biz/navigation/goBack.js +6 -0
- package/libs/api/biz/navigation/quit.js +6 -0
- package/libs/api/biz/navigation/replace.js +6 -0
- package/libs/api/biz/navigation/setIcon.js +7 -0
- package/libs/api/biz/navigation/setLeft.js +7 -0
- package/libs/api/biz/navigation/setMenu.js +7 -0
- package/libs/api/biz/navigation/setPanGestureEnable.js +7 -0
- package/libs/api/biz/navigation/setRight.js +7 -0
- package/libs/api/biz/navigation/setTitle.js +6 -0
- package/libs/api/biz/navigation/setTitleExpandIcon.js +7 -0
- package/libs/api/biz/navigation/setWindowBig.js +6 -1
- package/libs/api/biz/navigation/tencentMeeting.js +6 -0
- package/libs/api/biz/navigation/tencentMeetingBegin.js +6 -0
- package/libs/api/biz/navigation/updateExpandTitle.js +6 -0
- package/libs/api/biz/telephone/call.js +6 -0
- package/libs/api/biz/telephone/showCallMenu.js +6 -0
- package/libs/api/biz/util/addAppToNav.js +6 -0
- package/libs/api/biz/util/assistantCreate.js +6 -0
- package/libs/api/biz/util/authFinish.js +6 -0
- package/libs/api/biz/util/authStart.js +6 -0
- package/libs/api/biz/util/chosen.js +6 -0
- package/libs/api/biz/util/clipboardFileUpload.js +6 -0
- package/libs/api/biz/util/closeWindow.js +6 -0
- package/libs/api/biz/util/complain.js +6 -0
- package/libs/api/biz/util/createModifySchedule.js +6 -0
- package/libs/api/biz/util/datepicker.js +6 -0
- package/libs/api/biz/util/datetimepicker.js +6 -0
- package/libs/api/biz/util/disableScreenCapture.js +6 -0
- package/libs/api/biz/util/downloadFile.js +6 -0
- package/libs/api/biz/util/entergroupCheck.js +6 -0
- package/libs/api/biz/util/externalLinkPreviewFile.js +6 -0
- package/libs/api/biz/util/feedback.js +6 -0
- package/libs/api/biz/util/getSingleWebviewData.js +6 -0
- package/libs/api/biz/util/getTogetherConfig.js +6 -0
- package/libs/api/biz/util/getToken.js +6 -0
- package/libs/api/biz/util/injectScript.js +6 -0
- package/libs/api/biz/util/invoice.js +6 -1
- package/libs/api/biz/util/mediaFileUpload.js +6 -1
- package/libs/api/biz/util/onlineDocmentOpenTeamChat.js +6 -0
- package/libs/api/biz/util/open.js +6 -0
- package/libs/api/biz/util/openFutureGroup.js +6 -0
- package/libs/api/biz/util/openLink.js +6 -0
- package/libs/api/biz/util/openMediaFileDialog.js +6 -1
- package/libs/api/biz/util/openSingleWebview.js +6 -0
- package/libs/api/biz/util/openSlidePanel.js +6 -0
- package/libs/api/biz/util/openTalYoungToTopic.js +6 -1
- package/libs/api/biz/util/openTogetherEyeWebview.js +6 -0
- package/libs/api/biz/util/openUserSchedule.js +6 -0
- package/libs/api/biz/util/openVideoPlayer.js +6 -0
- package/libs/api/biz/util/previewFile.js +6 -0
- package/libs/api/biz/util/previewImage.js +6 -0
- package/libs/api/biz/util/proxy.js +6 -0
- package/libs/api/biz/util/pushWorkMsg.js +6 -1
- package/libs/api/biz/util/remind.js +6 -0
- package/libs/api/biz/util/resetSessionUnread.js +6 -0
- package/libs/api/biz/util/rouseApp.js +6 -1
- package/libs/api/biz/util/savePic.js +6 -0
- package/libs/api/biz/util/scan.js +6 -0
- package/libs/api/biz/util/selectDepartment.js +6 -0
- package/libs/api/biz/util/share.js +6 -0
- package/libs/api/biz/util/takePicture.js +6 -0
- package/libs/api/biz/util/uploadAttachment.js +6 -0
- package/libs/api/biz/util/yachEvent.js +6 -0
- package/libs/api/biz/util/zfbAuth.js +6 -0
- package/libs/api/biz/webViewMessage/send.js +6 -0
- package/libs/api/device/audio/download.js +6 -0
- package/libs/api/device/audio/onPlayEnd.js +6 -0
- package/libs/api/device/audio/onRecordEnd.js +6 -0
- package/libs/api/device/audio/onRecordEnd_v2.js +6 -0
- package/libs/api/device/audio/pause.js +6 -0
- package/libs/api/device/audio/play.js +6 -0
- package/libs/api/device/audio/resume.js +6 -0
- package/libs/api/device/audio/startRecord.js +6 -0
- package/libs/api/device/audio/startRecord_v2.js +6 -0
- package/libs/api/device/audio/stop.js +6 -0
- package/libs/api/device/audio/stopRecord.js +6 -0
- package/libs/api/device/audio/stopRecord_v2.js +6 -0
- package/libs/api/device/base/checkStepPermission.js +6 -0
- package/libs/api/device/base/getPhoneInfo.js +6 -0
- package/libs/api/device/base/getUUID.js +6 -0
- package/libs/api/device/connection/getNetworkType.js +6 -0
- package/libs/api/device/connection/isAtTal.js +8 -2
- package/libs/api/device/geolocation/get.js +6 -0
- package/libs/api/device/geolocation/getSwitch.js +6 -0
- package/libs/api/device/notification/actionSheet.js +6 -0
- package/libs/api/device/notification/alert.js +6 -0
- package/libs/api/device/notification/confirm.js +6 -0
- package/libs/api/device/notification/hidePreloader.js +6 -0
- package/libs/api/device/notification/showPreloader.js +6 -0
- package/libs/api/device/notification/toast.js +6 -0
- package/libs/api/device/notification/vibrate.js +6 -0
- package/libs/api/device/system/getLang.js +6 -0
- package/libs/api/device/system/setLight.js +6 -0
- package/libs/api/initAPI.js +13 -4
- package/libs/api/primary/createTab.js +6 -0
- package/libs/api/primary/exitFullScreen.js +6 -0
- package/libs/api/primary/fullScreen.js +6 -0
- package/libs/api/primary/weeklyShare.js +6 -0
- package/libs/api/runtime/permission/requestAuthCode.js +6 -0
- package/libs/api/ui/pullToRefresh/disable.js +6 -0
- package/libs/api/ui/pullToRefresh/enable.js +6 -0
- package/libs/api/ui/pullToRefresh/stop.js +6 -0
- package/libs/api/ui/webViewBounce/disable.js +6 -0
- package/libs/api/util/domainStorage/getItem.js +6 -0
- package/libs/api/util/domainStorage/removeItem.js +6 -0
- package/libs/api/util/domainStorage/setItem.js +6 -0
- package/libs/api/util/tool/flushLog.js +6 -0
- package/libs/api/util/tool/log.js +6 -0
- package/libs/index.js +275 -15
- package/libs/lib/bridge/index.js +7 -0
- package/libs/lib/bridge/mobile.js +45 -11
- package/libs/lib/bridge/pc.js +31 -11
- package/libs/lib/helper/apiHelper.js +6 -0
- package/libs/lib/helper/codeMap.js +6 -0
- package/libs/lib/helper/event.js +22 -1
- package/libs/lib/helper/pcIframe.js +51 -13
- package/libs/lib/index.js +32 -8
- package/libs/lib/sdk/index.js +45 -15
- package/libs/lib/sdk/sdk.typings.js +4 -0
- package/libs/utils/bpitLog.js +16 -4
- package/libs/utils/compareVersions.js +72 -27
- package/libs/utils/console.d.ts +1 -1
- package/libs/utils/console.js +18 -2
- package/libs/utils/env.js +21 -12
- package/libs/utils/index.js +13 -0
- package/package.json +1 -1
- package/dist/yach_jssdk_4.3.7.js +0 -1
package/libs/lib/bridge/index.js
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
|
|
4
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
8
|
+
|
|
7
9
|
_Object$defineProperty(exports, "PcBridgeInit", {
|
|
8
10
|
enumerable: true,
|
|
9
11
|
get: function get() {
|
|
10
12
|
return _pc.PcBridgeInit;
|
|
11
13
|
}
|
|
12
14
|
});
|
|
15
|
+
|
|
13
16
|
_Object$defineProperty(exports, "mobileBridge", {
|
|
14
17
|
enumerable: true,
|
|
15
18
|
get: function get() {
|
|
16
19
|
return _mobile.mobileBridge;
|
|
17
20
|
}
|
|
18
21
|
});
|
|
22
|
+
|
|
19
23
|
_Object$defineProperty(exports, "mobileBridgeInit", {
|
|
20
24
|
enumerable: true,
|
|
21
25
|
get: function get() {
|
|
22
26
|
return _mobile.mobileBridgeInit;
|
|
23
27
|
}
|
|
24
28
|
});
|
|
29
|
+
|
|
25
30
|
_Object$defineProperty(exports, "pcBridge", {
|
|
26
31
|
enumerable: true,
|
|
27
32
|
get: function get() {
|
|
28
33
|
return _pc.pcBridge;
|
|
29
34
|
}
|
|
30
35
|
});
|
|
36
|
+
|
|
31
37
|
var _mobile = require("./mobile");
|
|
38
|
+
|
|
32
39
|
var _pc = require("./pc");
|
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
|
|
4
5
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports.mobileBridgeInit = exports.mobileBridge = void 0;
|
|
12
|
+
|
|
9
13
|
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/set-timeout"));
|
|
14
|
+
|
|
10
15
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
|
|
16
|
+
|
|
11
17
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
|
|
18
|
+
|
|
12
19
|
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
|
|
20
|
+
|
|
13
21
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
|
|
22
|
+
|
|
14
23
|
var _event = _interopRequireDefault(require("../helper/event"));
|
|
24
|
+
|
|
15
25
|
var _codeMap = require("../helper/codeMap");
|
|
26
|
+
|
|
16
27
|
var _utils = require("../../utils");
|
|
28
|
+
|
|
17
29
|
function setupWebViewJavascriptBridge(callback) {
|
|
18
30
|
if (window.WebViewJavascriptBridge) {
|
|
19
31
|
return callback(WebViewJavascriptBridge);
|
|
20
32
|
}
|
|
33
|
+
|
|
21
34
|
if (window.WKWebViewJavascriptBridge) {
|
|
22
35
|
return callback(WKWebViewJavascriptBridge);
|
|
23
36
|
}
|
|
37
|
+
|
|
24
38
|
if (window.WVJBCallbacks) {
|
|
25
39
|
return window.WVJBCallbacks.push(callback);
|
|
26
40
|
}
|
|
41
|
+
|
|
27
42
|
window.WVJBCallbacks = [callback];
|
|
28
43
|
var WVJBIframe = document.createElement('iframe');
|
|
29
44
|
WVJBIframe.style.display = 'none';
|
|
@@ -33,7 +48,8 @@ function setupWebViewJavascriptBridge(callback) {
|
|
|
33
48
|
document.documentElement.removeChild(WVJBIframe);
|
|
34
49
|
}, 0);
|
|
35
50
|
}
|
|
36
|
-
|
|
51
|
+
|
|
52
|
+
var mobileBridgeInit = function mobileBridgeInit() {
|
|
37
53
|
return new _promise["default"](function (resolve, reject) {
|
|
38
54
|
setupWebViewJavascriptBridge(function (bridge) {
|
|
39
55
|
(0, _utils.log)("\u6CE8\u518Cresume\u4E8B\u4EF6 ");
|
|
@@ -41,6 +57,7 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
|
|
|
41
57
|
(0, _utils.log)("resume\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
42
58
|
resData: resData
|
|
43
59
|
});
|
|
60
|
+
|
|
44
61
|
_event["default"].execEvent('resume', resData);
|
|
45
62
|
});
|
|
46
63
|
(0, _utils.log)("\u6CE8\u518CunreadMsgAction\u4E8B\u4EF6 ");
|
|
@@ -48,6 +65,7 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
|
|
|
48
65
|
(0, _utils.log)("unreadMsgAction\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
49
66
|
resData: resData
|
|
50
67
|
});
|
|
68
|
+
|
|
51
69
|
_event["default"].execEvent('unreadMsgAction', resData);
|
|
52
70
|
});
|
|
53
71
|
(0, _utils.log)("\u6CE8\u518CwebViewMsgReceive\u4E8B\u4EF6 ");
|
|
@@ -55,31 +73,38 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
|
|
|
55
73
|
(0, _utils.log)("webViewMsgReceive\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
56
74
|
resData: resData
|
|
57
75
|
});
|
|
76
|
+
|
|
58
77
|
_event["default"].execEvent('webViewMsgReceive', resData);
|
|
59
78
|
});
|
|
60
79
|
bridge.registerHandler('pushWorkMsg', function (resData) {
|
|
61
80
|
(0, _utils.log)("pushWorkMsg\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
62
81
|
resData: resData
|
|
63
82
|
});
|
|
83
|
+
|
|
64
84
|
_event["default"].execEvent('pushWorkMsg', resData);
|
|
65
85
|
});
|
|
66
86
|
bridge.registerHandler('getTogetherCallback', function (resData) {
|
|
67
87
|
(0, _utils.log)("getTogetherCallback\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
68
88
|
resData: resData
|
|
69
89
|
});
|
|
90
|
+
|
|
70
91
|
_event["default"].execEvent('getTogetherCallback', resData);
|
|
71
92
|
});
|
|
72
93
|
bridge.registerHandler('sendMsgCommon', function (resData) {
|
|
73
94
|
(0, _utils.log)("sendMsgCommon ", {
|
|
74
95
|
resData: resData
|
|
75
96
|
});
|
|
97
|
+
|
|
76
98
|
_event["default"].execEvent('sendMsgCommon', resData);
|
|
77
99
|
});
|
|
78
100
|
resolve();
|
|
79
101
|
});
|
|
80
102
|
});
|
|
81
103
|
};
|
|
82
|
-
|
|
104
|
+
|
|
105
|
+
exports.mobileBridgeInit = mobileBridgeInit;
|
|
106
|
+
|
|
107
|
+
var mobileBridge = function mobileBridge(method, param) {
|
|
83
108
|
return new _promise["default"](function (resolve, reject) {
|
|
84
109
|
var p = (0, _assign["default"])({}, param);
|
|
85
110
|
setupWebViewJavascriptBridge(function (bridge) {
|
|
@@ -87,6 +112,7 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
|
|
|
87
112
|
bridge.registerHandler(method, function (data) {
|
|
88
113
|
var onSuccess = param.onSuccess;
|
|
89
114
|
delete p.onSuccess;
|
|
115
|
+
|
|
90
116
|
if ('function' === typeof onSuccess) {
|
|
91
117
|
onSuccess(data);
|
|
92
118
|
resolve({
|
|
@@ -96,11 +122,14 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
|
|
|
96
122
|
}
|
|
97
123
|
});
|
|
98
124
|
}
|
|
125
|
+
|
|
99
126
|
bridge.callHandler(method, param, function (e) {
|
|
100
127
|
var code = e.code,
|
|
101
|
-
|
|
102
|
-
|
|
128
|
+
message = e.message,
|
|
129
|
+
data = e.data;
|
|
130
|
+
|
|
103
131
|
var _code = (0, _parseInt2["default"])(code);
|
|
132
|
+
|
|
104
133
|
var callbackStr = (0, _codeMap.electronResCodeMap)(_code);
|
|
105
134
|
var callbackFun = p[callbackStr];
|
|
106
135
|
(0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
@@ -110,37 +139,40 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
|
|
|
110
139
|
_code: _code,
|
|
111
140
|
message: message,
|
|
112
141
|
callbackFun: callbackFun
|
|
113
|
-
});
|
|
114
|
-
|
|
142
|
+
}); // 请求失败
|
|
143
|
+
|
|
115
144
|
if (callbackStr === 'onFail') {
|
|
116
145
|
(0, _utils.bpitLog)({
|
|
117
146
|
method: method,
|
|
118
147
|
errorcode: _code,
|
|
119
148
|
message: message || (0, _stringify["default"])(data) || 'SDK执行失败回调,相关参数'
|
|
120
149
|
});
|
|
150
|
+
|
|
121
151
|
if ('function' === typeof callbackFun) {
|
|
122
152
|
message ? callbackFun({
|
|
123
153
|
code: code,
|
|
124
154
|
message: message
|
|
125
155
|
}) : callbackFun(data);
|
|
126
156
|
}
|
|
157
|
+
|
|
127
158
|
reject({
|
|
128
159
|
_code: _code,
|
|
129
160
|
message: message,
|
|
130
161
|
data: data
|
|
131
162
|
});
|
|
132
163
|
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
164
|
+
} // 请求成功
|
|
165
|
+
|
|
166
|
+
|
|
135
167
|
if ('function' === typeof callbackFun) {
|
|
136
168
|
callbackFun(data || message);
|
|
137
169
|
}
|
|
170
|
+
|
|
138
171
|
resolve({
|
|
139
172
|
_code: _code,
|
|
140
173
|
message: message,
|
|
141
174
|
data: data
|
|
142
|
-
});
|
|
143
|
-
// if (_code === -2 || _code === 7) {
|
|
175
|
+
}); // if (_code === -2 || _code === 7) {
|
|
144
176
|
// bpitLog({
|
|
145
177
|
// method,
|
|
146
178
|
// errorcode: _code,
|
|
@@ -172,4 +204,6 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
|
|
|
172
204
|
});
|
|
173
205
|
});
|
|
174
206
|
});
|
|
175
|
-
};
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
exports.mobileBridge = mobileBridge;
|
package/libs/lib/bridge/pc.js
CHANGED
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
|
|
4
5
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports.pcBridge = exports.PcBridgeInit = void 0;
|
|
12
|
+
|
|
9
13
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
|
|
14
|
+
|
|
10
15
|
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
|
|
16
|
+
|
|
11
17
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
|
|
18
|
+
|
|
12
19
|
var _pcIframe = _interopRequireDefault(require("../helper/pcIframe"));
|
|
20
|
+
|
|
13
21
|
var _codeMap = require("../helper/codeMap");
|
|
22
|
+
|
|
14
23
|
var _utils = require("../../utils");
|
|
15
|
-
|
|
24
|
+
|
|
25
|
+
var PcBridgeInit = function PcBridgeInit() {
|
|
16
26
|
_pcIframe["default"].init();
|
|
17
27
|
};
|
|
18
|
-
|
|
28
|
+
|
|
29
|
+
exports.PcBridgeInit = PcBridgeInit;
|
|
30
|
+
|
|
31
|
+
var pcBridge = function pcBridge(method, param) {
|
|
19
32
|
return new _promise["default"](function (resolve, reject) {
|
|
20
33
|
return _pcIframe["default"].invokeAPI(method, param, function (_ref) {
|
|
21
34
|
var data = _ref.data,
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
code = _ref.code,
|
|
36
|
+
message = _ref.message;
|
|
37
|
+
|
|
24
38
|
var _code = (0, _parseInt2["default"])(code);
|
|
39
|
+
|
|
25
40
|
var callbackStr = (0, _codeMap.electronResCodeMap)(_code);
|
|
26
41
|
var callbackFun = param[callbackStr];
|
|
27
42
|
(0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
@@ -31,14 +46,15 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
|
|
|
31
46
|
_code: _code,
|
|
32
47
|
message: message,
|
|
33
48
|
callbackFun: callbackFun
|
|
34
|
-
});
|
|
35
|
-
|
|
49
|
+
}); // 请求失败
|
|
50
|
+
|
|
36
51
|
if (callbackStr === 'onFail') {
|
|
37
52
|
(0, _utils.bpitLog)({
|
|
38
53
|
method: method,
|
|
39
54
|
errorcode: _code,
|
|
40
55
|
message: message || (0, _stringify["default"])(data) || 'SDK执行失败回调,相关参数'
|
|
41
56
|
});
|
|
57
|
+
|
|
42
58
|
if ('function' === typeof callbackFun) {
|
|
43
59
|
console.log('wenai-code', code, _code);
|
|
44
60
|
message ? callbackFun({
|
|
@@ -46,23 +62,25 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
|
|
|
46
62
|
message: message
|
|
47
63
|
}) : callbackFun(data);
|
|
48
64
|
}
|
|
65
|
+
|
|
49
66
|
reject({
|
|
50
67
|
_code: _code,
|
|
51
68
|
message: message,
|
|
52
69
|
data: data
|
|
53
70
|
});
|
|
54
71
|
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
72
|
+
} // 请求成功
|
|
73
|
+
|
|
74
|
+
|
|
57
75
|
if ('function' === typeof callbackFun) {
|
|
58
76
|
callbackFun(data || message);
|
|
59
77
|
}
|
|
78
|
+
|
|
60
79
|
resolve({
|
|
61
80
|
_code: _code,
|
|
62
81
|
message: message,
|
|
63
82
|
data: data
|
|
64
|
-
});
|
|
65
|
-
// if (_code === -2) {
|
|
83
|
+
}); // if (_code === -2) {
|
|
66
84
|
// bpitLog({
|
|
67
85
|
// method,
|
|
68
86
|
// errorcode: _code,
|
|
@@ -84,4 +102,6 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
|
|
|
84
102
|
// resolve({ _code, message, data });
|
|
85
103
|
});
|
|
86
104
|
});
|
|
87
|
-
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports.pcBridge = pcBridge;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
|
|
4
5
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports.genDefaultParamsDealFn = genDefaultParamsDealFn;
|
|
12
|
+
|
|
9
13
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
|
|
14
|
+
|
|
10
15
|
function genDefaultParamsDealFn(p) {
|
|
11
16
|
return function (r) {
|
|
12
17
|
return (0, _assign["default"])((0, _assign["default"])({}, p), r);
|
|
13
18
|
};
|
|
14
19
|
}
|
|
20
|
+
|
|
15
21
|
;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
|
|
4
5
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports.electronResCodeMap = electronResCodeMap;
|
|
12
|
+
|
|
9
13
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/map"));
|
|
14
|
+
|
|
10
15
|
var resCodeMap = new _map["default"]([[0, 'onSuccess'], [-1, 'onCancel'], [-2, 'onFail'], [-3, 'onProgress'], [-4, 'onSubmit']]);
|
|
16
|
+
|
|
11
17
|
function electronResCodeMap(code) {
|
|
12
18
|
return resCodeMap.get(code) || 'onFail';
|
|
13
19
|
}
|
package/libs/lib/helper/event.js
CHANGED
|
@@ -1,39 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
|
|
4
5
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports["default"] = void 0;
|
|
12
|
+
|
|
9
13
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/array/is-array"));
|
|
14
|
+
|
|
10
15
|
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/index-of"));
|
|
16
|
+
|
|
11
17
|
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/splice"));
|
|
18
|
+
|
|
12
19
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/for-each"));
|
|
20
|
+
|
|
13
21
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
22
|
+
|
|
14
23
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
24
|
+
|
|
15
25
|
var Event = /*#__PURE__*/(0, _createClass2["default"])(function Event() {
|
|
16
26
|
var _this = this;
|
|
27
|
+
|
|
17
28
|
(0, _classCallCheck2["default"])(this, Event);
|
|
29
|
+
|
|
18
30
|
this.on = function (event, fn) {
|
|
19
31
|
if (!event || 'function' !== typeof fn) throw 'eventName is null or handle is not a function, on fail';
|
|
20
32
|
if (!(0, _isArray["default"])(_this.eventsHandle[event])) _this.eventsHandle[event] = [];
|
|
33
|
+
|
|
21
34
|
_this.eventsHandle[event].push(fn);
|
|
22
35
|
};
|
|
36
|
+
|
|
23
37
|
this.off = function (event, fn) {
|
|
24
38
|
if (!event) throw 'eventName is null, invoke off fail';
|
|
39
|
+
|
|
25
40
|
if (!fn) {
|
|
26
41
|
_this.eventsHandle[event] = [];
|
|
27
42
|
return;
|
|
28
43
|
}
|
|
44
|
+
|
|
29
45
|
if ((0, _isArray["default"])(_this.eventsHandle[event])) {
|
|
30
46
|
var _context, _context2;
|
|
47
|
+
|
|
31
48
|
var n = (0, _indexOf["default"])(_context = _this.eventsHandle[event]).call(_context, fn);
|
|
32
49
|
-1 !== n && (0, _splice["default"])(_context2 = _this.eventsHandle[event]).call(_context2, n, 1);
|
|
33
50
|
}
|
|
34
51
|
};
|
|
52
|
+
|
|
35
53
|
this.execEvent = function (event, data) {
|
|
36
54
|
var _context3;
|
|
55
|
+
|
|
37
56
|
(0, _isArray["default"])(this.eventsHandle[event]) && (0, _forEach["default"])(_context3 = this.eventsHandle[event]).call(_context3, function (fn) {
|
|
38
57
|
try {
|
|
39
58
|
fn(data);
|
|
@@ -42,7 +61,9 @@ var Event = /*#__PURE__*/(0, _createClass2["default"])(function Event() {
|
|
|
42
61
|
}
|
|
43
62
|
});
|
|
44
63
|
};
|
|
64
|
+
|
|
45
65
|
this.eventsHandle = {};
|
|
46
66
|
});
|
|
47
67
|
var event = new Event();
|
|
48
|
-
var _default =
|
|
68
|
+
var _default = event;
|
|
69
|
+
exports["default"] = _default;
|
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
|
|
4
5
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports["default"] = void 0;
|
|
12
|
+
|
|
9
13
|
var _now = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/date/now"));
|
|
14
|
+
|
|
10
15
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
|
|
16
|
+
|
|
11
17
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
18
|
+
|
|
12
19
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
20
|
+
|
|
13
21
|
var _utils = require("../../utils");
|
|
22
|
+
|
|
14
23
|
var _event = _interopRequireDefault(require("./event"));
|
|
24
|
+
|
|
15
25
|
// 处理posmessage参数
|
|
16
26
|
var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(method, param, callback) {
|
|
17
27
|
var _this = this;
|
|
28
|
+
|
|
18
29
|
(0, _classCallCheck2["default"])(this, GenPostMsg);
|
|
30
|
+
|
|
19
31
|
this.genid = function () {
|
|
20
32
|
var idStr = (0, _now["default"])().toString(36);
|
|
21
33
|
idStr += Math.random().toString(36).substr(3);
|
|
22
34
|
return idStr;
|
|
23
35
|
};
|
|
36
|
+
|
|
24
37
|
this.receiveResponse = function (data) {
|
|
25
38
|
//this.PromiseObj.resolve(data);
|
|
26
39
|
_this.callback(data);
|
|
27
40
|
};
|
|
41
|
+
|
|
28
42
|
this.getPayload = function () {
|
|
29
43
|
return {
|
|
30
44
|
msgId: _this.id,
|
|
@@ -34,6 +48,7 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
|
|
|
34
48
|
invokeType: _this.invokeType
|
|
35
49
|
};
|
|
36
50
|
};
|
|
51
|
+
|
|
37
52
|
this.id = this.genid();
|
|
38
53
|
this.PromiseObj = {
|
|
39
54
|
resolve: null,
|
|
@@ -42,8 +57,7 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
|
|
|
42
57
|
this.methodName = method;
|
|
43
58
|
this.plainMsg = param;
|
|
44
59
|
this.invokeType = param === null || param === void 0 ? void 0 : param.invokeType;
|
|
45
|
-
this.callback = callback;
|
|
46
|
-
// this.result = new Promise(
|
|
60
|
+
this.callback = callback; // this.result = new Promise(
|
|
47
61
|
// function (resolve, reject) {
|
|
48
62
|
// this.PromiseObj = {
|
|
49
63
|
// resolve,
|
|
@@ -54,59 +68,76 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
|
|
|
54
68
|
});
|
|
55
69
|
var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
|
|
56
70
|
var _this2 = this;
|
|
71
|
+
|
|
57
72
|
(0, _classCallCheck2["default"])(this, Frame);
|
|
73
|
+
|
|
58
74
|
this.addPending = function (e) {
|
|
59
75
|
_this2.pendingMsgs[e.id] = e;
|
|
60
76
|
};
|
|
77
|
+
|
|
61
78
|
this.deletePending = function (e) {
|
|
62
79
|
delete _this2.pendingMsgs[e.id];
|
|
63
80
|
};
|
|
81
|
+
|
|
64
82
|
this.getPending = function (t) {
|
|
65
83
|
return this.pendingMsgs[t];
|
|
66
84
|
};
|
|
85
|
+
|
|
67
86
|
this.invokeAPIInBrowserView = function (payload) {
|
|
68
87
|
window.sendTo(payload);
|
|
69
88
|
};
|
|
89
|
+
|
|
70
90
|
this.invokeAPIInWebview = function (payload) {
|
|
71
91
|
window.sendToHost(payload);
|
|
72
92
|
};
|
|
93
|
+
|
|
73
94
|
this.invokeAPI = function (method, param, callback) {
|
|
74
95
|
var genPostMsg = new GenPostMsg(method, param, callback);
|
|
75
96
|
var payload = (0, _stringify["default"])(genPostMsg.getPayload());
|
|
76
97
|
var _param$invokeType = param.invokeType,
|
|
77
|
-
|
|
98
|
+
invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
|
|
78
99
|
invokeType === 'browserView' ? _this2.invokeAPIInBrowserView(payload) : _this2.invokeAPIInWebview(payload);
|
|
100
|
+
|
|
79
101
|
_this2.addPending(genPostMsg);
|
|
102
|
+
|
|
80
103
|
return genPostMsg;
|
|
81
104
|
};
|
|
105
|
+
|
|
82
106
|
this.handleCallback = function (datas, invokeType) {
|
|
83
107
|
var type = datas.type,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
108
|
+
methodName = datas.methodName,
|
|
109
|
+
eventName = datas.eventName,
|
|
110
|
+
msgId = datas.msgId,
|
|
111
|
+
_datas$data = datas.data,
|
|
112
|
+
data = _datas$data === void 0 ? {} : _datas$data,
|
|
113
|
+
code = datas.code,
|
|
114
|
+
message = datas.message,
|
|
115
|
+
msg = datas.msg;
|
|
116
|
+
|
|
92
117
|
if (type === 'request') {
|
|
93
118
|
// 壳子的调用
|
|
94
119
|
switch (methodName) {
|
|
95
120
|
case 'refresh':
|
|
96
121
|
window.location.reload();
|
|
97
122
|
break;
|
|
123
|
+
|
|
98
124
|
case 'back':
|
|
99
125
|
window.history.back();
|
|
100
126
|
break;
|
|
127
|
+
|
|
101
128
|
case 'forward':
|
|
102
129
|
window.history.forward();
|
|
103
130
|
break;
|
|
131
|
+
|
|
104
132
|
case 'event':
|
|
105
133
|
_event["default"].execEvent(eventName, data);
|
|
134
|
+
|
|
106
135
|
break;
|
|
136
|
+
|
|
107
137
|
case 'zoomInClick':
|
|
108
138
|
var scrollTopVal = document.documentElement.scrollTop || document.body.scrollTop,
|
|
109
|
-
|
|
139
|
+
url = window.location.href;
|
|
140
|
+
|
|
110
141
|
if (invokeType === 'browserView') {
|
|
111
142
|
window.sendTo((0, _stringify["default"])({
|
|
112
143
|
type: type,
|
|
@@ -128,13 +159,16 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
|
|
|
128
159
|
}
|
|
129
160
|
}));
|
|
130
161
|
}
|
|
162
|
+
|
|
131
163
|
break;
|
|
164
|
+
|
|
132
165
|
default:
|
|
133
166
|
break;
|
|
134
167
|
}
|
|
135
168
|
} else if (type === 'response') {
|
|
136
169
|
// 响应壳子的回调
|
|
137
170
|
var pending = _this2.getPending(msgId);
|
|
171
|
+
|
|
138
172
|
pending && pending.receiveResponse({
|
|
139
173
|
data: data,
|
|
140
174
|
code: code,
|
|
@@ -143,16 +177,20 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
|
|
|
143
177
|
code != -3 && _this2.deletePending(msgId);
|
|
144
178
|
}
|
|
145
179
|
};
|
|
180
|
+
|
|
146
181
|
this.init = function () {
|
|
147
182
|
window.addEventListener('message', function (msg) {
|
|
148
183
|
(0, _utils.log)('electron res: ', msg);
|
|
184
|
+
|
|
149
185
|
_this2.handleCallback(msg.data || {});
|
|
150
186
|
});
|
|
151
187
|
window.receiveBrowserViewData && window.receiveBrowserViewData(function (e, response) {
|
|
152
188
|
return _this2.handleCallback(response);
|
|
153
189
|
});
|
|
154
190
|
};
|
|
191
|
+
|
|
155
192
|
this.pendingMsgs = {};
|
|
156
193
|
});
|
|
157
194
|
var frame = new Frame();
|
|
158
|
-
var _default =
|
|
195
|
+
var _default = frame;
|
|
196
|
+
exports["default"] = _default;
|