diff --git a/examples/mini-program-example/src/pages/index/index.tsx b/examples/mini-program-example/src/pages/index/index.tsx
index 135869ac3e75..0cf6a80a890d 100644
--- a/examples/mini-program-example/src/pages/index/index.tsx
+++ b/examples/mini-program-example/src/pages/index/index.tsx
@@ -49,21 +49,20 @@ export default function Index() {
)
diff --git a/examples/mini-program-example/src/util/nativeApi.ts b/examples/mini-program-example/src/util/nativeApi.ts
index f9d8ed5af7c5..36f7576fa80d 100644
--- a/examples/mini-program-example/src/util/nativeApi.ts
+++ b/examples/mini-program-example/src/util/nativeApi.ts
@@ -1,13 +1,14 @@
// @ts-ignore
-const decorator = window.MethodChannel && window.MethodChannel.jsBridgeMode({ isAsync: false, autoRelease: true }) || (target => target)
+const sync = window.MethodChannel && window.MethodChannel.jsBridgeMode({ isAsync: false, autoRelease: true }) || (target => target)
// @proxyClassSign('')
class NativeApi {
- // @ts-ignore
- @decorator
- harmonyNavigateTo(options: any) {
- return options
- }
+ @sync
+ navigateToTaroHybrid(_options: any) {}
+
+
+ @sync
+ navigateToNative(_options: any){}
}
const nativeApi = new NativeApi()
diff --git a/packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json b/packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json
index 817537f12991..789b05edaae3 100644
--- a/packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json
+++ b/packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json
@@ -757,12 +757,7 @@
"TARO_ENV": true,
"USER_DATA_PATH": true
},
- "exitMiniProgram": {
- "object": {
- "url": true,
- "events": true
- }
- },
+ "exitMiniProgram": true,
"exitVoIPChat": false,
"faceDetect": false,
"faceVerifyForPay": false,
diff --git a/packages/taro-platform-harmony-hybrid/src/api/apis/NativeApi.ts b/packages/taro-platform-harmony-hybrid/src/api/apis/NativeApi.ts
index e1ed2f0cc34f..28e7a4f8ee17 100644
--- a/packages/taro-platform-harmony-hybrid/src/api/apis/NativeApi.ts
+++ b/packages/taro-platform-harmony-hybrid/src/api/apis/NativeApi.ts
@@ -1,6 +1,6 @@
// import {timeLog} from "./NativeApiLog";
import { syncApiCache } from './harmony-native/ApiCache'
-import { asyncAndNotRelease, asyncAndRelease, syncAndRelease } from './harmony-native/ApiDecorator'
+import { asyncAndNotRelease, asyncAndRelease, syncAndNotRelease, syncAndRelease } from './harmony-native/ApiDecorator'
import { storageCacheAndSyncProxy } from './harmony-native/StorageCacheAndSyncProxy'
import { NativeDataChangeListener, SyncCacheProxyHandler } from './NativeApiSyncCacheProxy'
@@ -627,6 +627,12 @@ export class NativeApi {
exitMiniProgram (option?: any): any {
return option
}
+
+ @(syncAndNotRelease)
+ onStorageStatusChange (_options: any): void {}
+
+ @(syncAndNotRelease)
+ offStorageStatusChange (_options: any): void {}
}
export interface Status {
diff --git a/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/ApiDecorator.ts b/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/ApiDecorator.ts
index 06badb60464c..99b13e109a6e 100644
--- a/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/ApiDecorator.ts
+++ b/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/ApiDecorator.ts
@@ -2,7 +2,7 @@
export const syncAndRelease = window.MethodChannel && window.MethodChannel.jsBridgeMode({ isAsync: false, autoRelease: true }) || (target => target)
// @ts-ignore
-// const syncAndNotRelease = window.MethodChannel && window.MethodChannel.jsBridgeMode({ isAsync: false, autoRelease: false }) || (target => target)
+export const syncAndNotRelease = window.MethodChannel && window.MethodChannel.jsBridgeMode({ isAsync: false, autoRelease: false }) || (target => target)
// @ts-ignore
export const asyncAndRelease = window.MethodChannel && window.MethodChannel.jsBridgeMode({ isAsync: true, autoRelease: true }) || (target => target)
diff --git a/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts b/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts
index c2edd9ae56c7..93f0d9e06b07 100644
--- a/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts
+++ b/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts
@@ -1,3 +1,4 @@
+const TYPE_STORAGE_UPDATE_EVENT_CLEAR = 'TYPE_STORAGE_UPDATE_EVENT_CLEAR'
class ProxyHandler {
private cacheMap: Map
private pageHasShowed: boolean = false
@@ -28,6 +29,14 @@ class ProxyHandler {
})
}, 2000)
})
+
+ native.onStorageStatusChange((type: string, key: string) => {
+ if (type === TYPE_STORAGE_UPDATE_EVENT_CLEAR) {
+ this.cacheMap.clear()
+ } else {
+ this.cacheMap.delete(key)
+ }
+ })
}
get (target, propKey, receiver) {