Skip to content

Commit b4b4f0c

Browse files
authored
Merge pull request #15 from yeslow/worker-turbo-module
feat: 适配worker turbo module
2 parents 20dd566 + fbacb1f commit b4b4f0c

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Use these variables when you tailor your ArkTS code. They must be of the const type.
3+
*/
4+
export const HAR_VERSION = '1.21.0-0.1.7';
5+
export const BUILD_MODE_NAME = 'debug';
6+
export const DEBUG = true;
7+
export const TARGET_NAME = 'default';
8+
9+
/**
10+
* BuildProfile Class is used only for compatibility purposes.
11+
*/
12+
export default class BuildProfile {
13+
static readonly HAR_VERSION = HAR_VERSION;
14+
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
15+
static readonly DEBUG = DEBUG;
16+
static readonly TARGET_NAME = TARGET_NAME;
17+
}

packages/default-storage/harmony/async_storage/src/main/ets/AsyncStoragePackage.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
* SOFTWARE.
2323
*/
2424

25-
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
26-
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
25+
import { RNPackage,WorkerTurboModuleFactory } from '@rnoh/react-native-openharmony/ts';
26+
import type { WorkerTurboModule,WorkerTurboModuleContext } from '@rnoh/react-native-openharmony/ts';
2727
import { AsyncStorageTurboModule } from './AsyncStorageTurboModule';
2828

29-
class AsyncStorageTurboModulesFactory extends TurboModulesFactory {
29+
class AsyncStorageTurboModulesFactory extends WorkerTurboModuleFactory {
3030

31-
createTurboModule(name: string): TurboModule | null {
31+
createTurboModule(name: string): WorkerTurboModule | null {
3232
if (name === 'RNCAsyncStorage') {
3333
return new AsyncStorageTurboModule(this.ctx);
3434
}
@@ -41,7 +41,7 @@ class AsyncStorageTurboModulesFactory extends TurboModulesFactory {
4141
}
4242

4343
export class AsyncStoragePackage extends RNPackage {
44-
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
44+
createWorkerTurboModuleFactory(ctx: WorkerTurboModuleContext): WorkerTurboModuleFactory{
4545
return new AsyncStorageTurboModulesFactory(ctx);
4646
}
4747
}

packages/default-storage/harmony/async_storage/src/main/ets/AsyncStorageTurboModule.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,23 @@
2222
* SOFTWARE.
2323
*/
2424

25-
import relationalStore from '@ohos.data.relationalStore'
26-
import taskpool from '@ohos.taskpool';
27-
import { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
25+
import relationalStore from '@ohos.data.relationalStore';
26+
import { WorkerTurboModule,WorkerTurboModuleContext } from '@rnoh/react-native-openharmony/ts';
2827
import ReactDatabaseSupplier from './ReactDatabaseSupplier';
2928
import AsyncStorageErrorUtil from './AsyncStorageErrorUtil';
3029
import Logger from './Logger';
31-
import CommonConstants from './CommonConstants'
30+
import CommonConstants from './CommonConstants';
3231
import AsyncLocalStorageUtil from './AsyncLocalStorageUtil';
33-
import AsyncLocker from './AsyncLocker'
32+
import AsyncLocker from './AsyncLocker';
3433

3534
const MAX_SQL_KEYS = 999;
3635

37-
export class AsyncStorageTurboModule extends TurboModule {
36+
export class AsyncStorageTurboModule extends WorkerTurboModule {
3837

3938
private table = new ReactDatabaseSupplier()
4039
private lock: AsyncLocker = new AsyncLocker()
4140

42-
constructor(ctx: TurboModuleContext) {
41+
constructor(ctx: WorkerTurboModuleContext) {
4342
super(ctx);
4443
Logger.debug(CommonConstants.TAG, `AsyncStorageTurboModule construct!`);
4544
this.table.initialRdbStore(this.ctx.uiAbilityContext);

0 commit comments

Comments
 (0)