@doubao-dev/taro-runtime 0.0.39 → 0.0.40

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.
@@ -124,8 +124,7 @@ export function onLocationChange(callback) {
124
124
  city: event.city
125
125
  });
126
126
  };
127
- appFrameworkApi.onLocationChange(appCallback);
128
- locationChangeCallbacks.set(callback, () => appFrameworkApi.offLocationChange(appCallback));
127
+ locationChangeCallbacks.set(callback, appFrameworkApi.onLocationChange(appCallback));
129
128
  }
130
129
  export function offLocationChange(callback) {
131
130
  if (typeof callback === 'function') {
@@ -153,8 +152,7 @@ export function onLocationChangeError(callback) {
153
152
  errCode: event.errCode
154
153
  });
155
154
  };
156
- appFrameworkApi.onLocationChangeError(appCallback);
157
- locationChangeErrorCallbacks.set(callback, () => appFrameworkApi.offLocationChangeError(appCallback));
155
+ locationChangeErrorCallbacks.set(callback, appFrameworkApi.onLocationChangeError(appCallback));
158
156
  }
159
157
  export function offLocationChangeError(callback) {
160
158
  if (typeof callback === 'function') {
@@ -1,4 +1,4 @@
1
- import { getDeviceInfoSync as appGetDeviceInfoSync, getMenuButtonBoundingClientRect as appGetMenuButtonBoundingClientRect, getNetworkType as appGetNetworkType, getScreenBrightness as appGetScreenBrightness, getSystemSetting as appGetSystemSetting, makePhoneCall as appMakePhoneCall, onKeyboardHeightChange as appOnKeyboardHeightChange, onNetworkStatusChange as appOnNetworkStatusChange, onThemeChange as appOnThemeChange, setClipboardData as appSetClipboardData, getAppBaseInfoSync, getWindowInfoSync } from '@byted-doubao-apps/framework/api';
1
+ import { getAppAuthorizeSetting as appGetAppAuthorizeSetting, getDeviceInfoSync as appGetDeviceInfoSync, getMenuButtonBoundingClientRect as appGetMenuButtonBoundingClientRect, getNetworkType as appGetNetworkType, getScreenBrightness as appGetScreenBrightness, getSystemSetting as appGetSystemSetting, makePhoneCall as appMakePhoneCall, onKeyboardHeightChange as appOnKeyboardHeightChange, onNetworkStatusChange as appOnNetworkStatusChange, onThemeChange as appOnThemeChange, setClipboardData as appSetClipboardData, getAppBaseInfoSync, getWindowInfoSync } from '@byted-doubao-apps/framework/api';
2
2
  import { buildFailCallbackResult, emitFailure, runCallbackApi, runTaroApi } from '../utils.js';
3
3
  const networkStatusChangeCallbacks = new Map();
4
4
  const keyboardHeightChangeCallbacks = new Map();
@@ -27,19 +27,7 @@ export function getSystemSetting() {
27
27
  return systemSetting;
28
28
  }
29
29
  export function getAppAuthorizeSetting() {
30
- return {
31
- albumAuthorized: 'not determined',
32
- bluetoothAuthorized: 'not determined',
33
- cameraAuthorized: 'not determined',
34
- locationAuthorized: 'not determined',
35
- locationReducedAccuracy: false,
36
- microphoneAuthorized: 'not determined',
37
- notificationAuthorized: 'not determined',
38
- notificationAlertAuthorized: 'not determined',
39
- notificationBadgeAuthorized: 'not determined',
40
- notificationSoundAuthorized: 'not determined',
41
- phoneCalendarAuthorized: 'not determined'
42
- };
30
+ return appGetAppAuthorizeSetting();
43
31
  }
44
32
  export function getDeviceInfo() {
45
33
  const result = appGetDeviceInfoSync?.() || {};
@@ -1,3 +1,2 @@
1
- export { useError, useLaunch, usePageNotFound, useDidHide, useDidShow } from '../hooks/lifecycle/app.js';
2
- export * from './common.js';
1
+ export * from './view-core.js';
3
2
  //# sourceMappingURL=app-core.d.ts.map
@@ -1,3 +1,2 @@
1
- export { useError, useLaunch, usePageNotFound, useDidHide, useDidShow } from '../hooks/lifecycle/app.js';
2
- export * from './common.js';
1
+ export * from './view-core.js';
3
2
  //# sourceMappingURL=app-core.js.map
@@ -1,3 +1,4 @@
1
1
  export * from './common.js';
2
- export { useCreated as useLoad, useMounted as useReady, useShow as useDidShow, useHide as useDidHide, useError, useDestroy as useUnload } from '@byted-doubao-apps/framework';
2
+ export { useError, useLaunch, usePageNotFound, useDidHide, useDidShow } from '../hooks/lifecycle/app.js';
3
+ export { useCreated as useLoad, useMounted as useReady, useDestroy as useUnload } from '@byted-doubao-apps/framework';
3
4
  //# sourceMappingURL=view-core.d.ts.map
@@ -1,3 +1,4 @@
1
1
  export * from './common.js';
2
- export { useCreated as useLoad, useMounted as useReady, useShow as useDidShow, useHide as useDidHide, useError, useDestroy as useUnload } from '@byted-doubao-apps/framework';
2
+ export { useError, useLaunch, usePageNotFound, useDidHide, useDidShow } from '../hooks/lifecycle/app.js';
3
+ export { useCreated as useLoad, useMounted as useReady, useDestroy as useUnload } from '@byted-doubao-apps/framework';
3
4
  //# sourceMappingURL=view-core.js.map
@@ -1,15 +1,22 @@
1
- import { APP_ID, registerLifecycle } from '../../internal/lifecycle/index.js';
1
+ import { useError as useViewError, useHide as useViewDidHide, useShow as useViewDidShow } from '@byted-doubao-apps/framework';
2
+ import { APP_ID, getCurrentId, registerLifecycle } from '../../internal/lifecycle/index.js';
2
3
  import { warnUnsupported } from '../../utils/warn-unsupported.js';
3
4
  export function useLaunch(callback) {
4
5
  registerLifecycle('onLaunch', callback, APP_ID);
5
6
  }
6
7
  export function useDidShow(callback) {
8
+ if (getCurrentId() !== APP_ID) {
9
+ return useViewDidShow(callback);
10
+ }
7
11
  // registerLifecycle('onForeground', callback, APP_ID);
8
12
  // useDidShow -> not supported
9
13
  void callback;
10
14
  warnUnsupported('onDidShow');
11
15
  }
12
16
  export function useDidHide(callback) {
17
+ if (getCurrentId() !== APP_ID) {
18
+ return useViewDidHide(callback);
19
+ }
13
20
  // registerLifecycle('onBackground', callback, APP_ID);
14
21
  // useDidHide -> not supported
15
22
  void callback;
@@ -19,6 +26,9 @@ export function useDidHide(callback) {
19
26
  // registerLifecycle('onDestroy', callback, APP_ID);
20
27
  // }
21
28
  export function useError(callback) {
29
+ if (getCurrentId() !== APP_ID) {
30
+ return useViewError(callback);
31
+ }
22
32
  registerLifecycle('onError', callback, APP_ID);
23
33
  }
24
34
  export function usePageNotFound(callback) {
@@ -1,6 +1,6 @@
1
1
  import type { UnifiedLifecycleRegistry, UnifiedLifecycleType } from '../../types/internal/lifecycle-types.js';
2
2
  export declare const APP_ID = "taro_app";
3
- export declare function setCurrentId(id: string): void;
3
+ export declare function setCurrentId(id: string | null): void;
4
4
  export declare function getCurrentId(): string | null;
5
5
  export declare function getLifecycle(id: string): UnifiedLifecycleRegistry;
6
6
  export declare function registerLifecycle(type: UnifiedLifecycleType, handler: (...args: any[]) => void, id: string): void;
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "access": "public",
38
38
  "registry": "https://registry.npmjs.org/"
39
39
  },
40
- "version": "0.0.39",
40
+ "version": "0.0.40",
41
41
  "scripts": {
42
42
  "dev": "npm run build -- -w",
43
43
  "build": "rimraf dist bundle && tsc -p tsconfig.build.json",