iOS:fix memory leak

This commit is contained in:
pengfei.zhou 2021-07-23 10:03:19 +08:00 committed by osborn
parent 0a54a5a5e7
commit 05655972e3
4 changed files with 20 additions and 2 deletions

View File

@ -28,7 +28,7 @@ @implementation DoricSingleton
- (instancetype)init {
if (self = [super init]) {
_libraries = [NSMutableSet new];
_registries = [NSHashTable new];
_registries = [NSHashTable weakObjectsHashTable];
_envDic = [NSMutableDictionary new];
_enablePerformance = NO;
_enableRecordSnapshot = NO;

View File

@ -38,7 +38,7 @@ - (instancetype)initWithName:(NSString *)name {
_anchorQueue = dispatch_queue_create("doric.performance.profile", DISPATCH_QUEUE_SERIAL);
_anchorMap = [NSMutableDictionary new];
_enable = DoricSingleton.instance.enablePerformance;
_hooks = [NSHashTable new];
_hooks = [NSHashTable weakObjectsHashTable];
}
return self;
}

9
doric-js/index.d.ts vendored
View File

@ -795,6 +795,15 @@ declare module 'doric/lib/src/widget/input' {
editable?: boolean;
returnKeyType?: ReturnKeyType;
onSubmitEditing?: (text: string) => void;
/**
* Called before text is changed
* @param editing: text already in box
* @param replacement: text which will replace part of editing
* @param start: the start index of replacing part
* @param length: the length of replacing part
*
* @returns: true means the replacement will take effect, otherwise does not
*/
beforeTextChange?: (change: {
editing: string;
start: number;

View File

@ -28,6 +28,15 @@ export declare class Input extends View {
editable?: boolean;
returnKeyType?: ReturnKeyType;
onSubmitEditing?: (text: string) => void;
/**
* Called before text is changed
* @param editing: text already in box
* @param replacement: text which will replace part of editing
* @param start: the start index of replacing part
* @param length: the length of replacing part
*
* @returns: true means the replacement will take effect, otherwise does not
*/
beforeTextChange?: (change: {
editing: string;
start: number;