@revues/web-sdk-core 0.0.1-beta.17 → 0.0.1-beta.19

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.
@@ -4282,14 +4282,23 @@
4282
4282
  }
4283
4283
  WebFrameEventBus.emit('tabItemChanged', payload);
4284
4284
  }
4285
- function initWebFrame(config) {
4285
+ function initWebFrame(opts) {
4286
4286
  if (typeof window.__initWebFrame === 'undefined')
4287
4287
  return;
4288
4288
  WebFrameEventBus.on('NavigatorBarTools:onMore', function () {
4289
4289
  APIS.showToast({ title: '暂未实现该功能' });
4290
4290
  });
4291
4291
  WebFrameEventBus.on('NavigatorBarTools:onClose', function () {
4292
- APIS.showToast({ title: '暂未实现该功能' });
4292
+ var adapter = getTarget();
4293
+ if (adapter != null) {
4294
+ adapter.invokeHandler({
4295
+ callbackId: -1,
4296
+ apiName: 'exitMiniProgram',
4297
+ params: {},
4298
+ from: 'service'
4299
+ });
4300
+ }
4301
+ // APIS.showToast({title: '暂未实现该功能'})
4293
4302
  });
4294
4303
  WebFrameEventBus.on('NavigatorBar:onBack', function () {
4295
4304
  routeApis.navigateBack({ delta: 1 });
@@ -4308,7 +4317,7 @@
4308
4317
  invokeServiceCallbackHandler(payload.callbackId, payload.data);
4309
4318
  });
4310
4319
  //
4311
- window.__initWebFrame(config, WebFrameEventBus);
4320
+ window.__initWebFrame(opts, WebFrameEventBus);
4312
4321
  }
4313
4322
 
4314
4323
  var globalApis = {
@@ -4857,7 +4866,8 @@
4857
4866
  }
4858
4867
  };
4859
4868
  function getScorllY() {
4860
- var innerWindow = router.currPage.getWindow();
4869
+ var _a;
4870
+ var innerWindow = (_a = router.currPage) === null || _a === void 0 ? void 0 : _a.getWindow();
4861
4871
  if (innerWindow != null) {
4862
4872
  var doc = innerWindow.document;
4863
4873
  return doc.documentElement.scrollTop || doc.body.scrollTop;
@@ -4865,20 +4875,23 @@
4865
4875
  return 0;
4866
4876
  }
4867
4877
  function getWindowBaseInfo() {
4878
+ var innerWidth = window.innerWidth || 390;
4879
+ var innerHeight = window.innerHeight || 844;
4880
+ var system = getSystem();
4868
4881
  var resolutionRatio = 750; // 这个要通过原生注入
4869
- var statusBarHeight = 22; // 这个要通过原生注入
4870
- var pixelRatio = resolutionRatio / window.innerWidth;
4882
+ var statusBarHeight = system.toLocaleLowerCase().includes('window') ? 0 : 50; // 这个要通过原生注入
4883
+ var pixelRatio = resolutionRatio / innerWidth;
4871
4884
  return {
4872
- screenWidth: window.innerWidth,
4873
- screenHeight: window.innerHeight,
4885
+ screenWidth: innerWidth,
4886
+ screenHeight: innerHeight,
4874
4887
  statusBarHeight: statusBarHeight,
4875
4888
  devicePixelRatio: pixelRatio,
4876
4889
  pixelRatio: pixelRatio,
4877
- windowHeight: window.innerHeight,
4878
- windowWidth: window.innerWidth,
4890
+ windowHeight: innerHeight,
4891
+ windowWidth: innerWidth,
4879
4892
  safeArea: {
4880
- height: window.innerHeight - statusBarHeight,
4881
- widows: window.innerWidth,
4893
+ height: innerHeight - statusBarHeight,
4894
+ widows: innerWidth,
4882
4895
  top: statusBarHeight,
4883
4896
  left: 0,
4884
4897
  right: 0
@@ -5123,12 +5136,12 @@
5123
5136
 
5124
5137
  var lifecycleGameHandlers = {
5125
5138
  gameServiceReady: function () {
5126
- initWebFrame({});
5127
- WebFrameEventBus.emit('closeLaunchMask');
5128
5139
  },
5129
5140
  gameConfigUpdate: function (_a) {
5130
5141
  var _b;
5131
5142
  var params = _a.params;
5143
+ initWebFrame({ windowInfo: APIS.getWindowInfo(), wxConfig: params });
5144
+ WebFrameEventBus.emit('closeLaunchMask');
5132
5145
  var currentDeviceOrientation = getCurrentDeviceOrientation();
5133
5146
  if (params.deviceOrientation !== currentDeviceOrientation) {
5134
5147
  // 切换到游戏配置的设备方向
@@ -5150,7 +5163,10 @@
5150
5163
  setWxConfig(e.params);
5151
5164
  var params = e.params;
5152
5165
  initFirstPageByWxConfig(params);
5153
- initWebFrame(params);
5166
+ initWebFrame({
5167
+ wxConfig: params,
5168
+ windowInfo: APIS.getWindowInfo()
5169
+ });
5154
5170
  },
5155
5171
  // 通知 native
5156
5172
  onLaunchCalled: function (e) { },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revues/web-sdk-core",
3
- "version": "0.0.1-beta.17",
3
+ "version": "0.0.1-beta.19",
4
4
  "description": "> TODO: description",
5
5
  "author": "diamondloler <857276958@qq.com>",
6
6
  "homepage": "",
@@ -30,5 +30,5 @@
30
30
  "devDependencies": {
31
31
  "@types/howler": "^2.2.11"
32
32
  },
33
- "gitHead": "332f79f40eafdf245f74a41aa293c5031428d881"
33
+ "gitHead": "467b64993d87fa2aa48440c32a3760a1617a8952"
34
34
  }