mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-12-02 12:29:44 +00:00
commit
60211b061b
@ -69,6 +69,7 @@ function mergeMaps(stageMap: Map<Symbol, AttributeModifierWithKey>,
|
||||
class ModifierUtils {
|
||||
static dirtyComponentSet: Set<ArkComponent | ArkSpanComponent> = new Set();
|
||||
static dirtyFlag = false;
|
||||
static timeoutId = -1;
|
||||
|
||||
static copyModifierWithKey(obj: ModifierWithKey<string | number | boolean | object>): ModifierWithKey<string | number | boolean | object> {
|
||||
let newObj: ModifierWithKey<string | number | boolean | object> = {
|
||||
@ -160,6 +161,9 @@ class ModifierUtils {
|
||||
|
||||
static requestFrame(): void {
|
||||
const frameCallback = () => {
|
||||
if (this.timeoutId !== -1) {
|
||||
clearTimeout(this.timeoutId);
|
||||
}
|
||||
this.dirtyComponentSet.forEach(item => {
|
||||
const nativePtrValid = !item._weakPtr.invalid();
|
||||
if (item._nativePtrChanged && nativePtrValid) {
|
||||
@ -175,8 +179,12 @@ class ModifierUtils {
|
||||
});
|
||||
this.dirtyComponentSet.clear();
|
||||
this.dirtyFlag = false;
|
||||
this.timeoutId = -1;
|
||||
};
|
||||
|
||||
if (this.timeoutId !== -1) {
|
||||
clearTimeout(this.timeoutId);
|
||||
}
|
||||
this.timeoutId = setTimeout(frameCallback, 100);
|
||||
getUINativeModule().frameNode.registerFrameCallback(frameCallback);
|
||||
}
|
||||
}
|
||||
|
@ -118,6 +118,9 @@ class ModifierUtils {
|
||||
}
|
||||
static requestFrame() {
|
||||
const frameCallback = () => {
|
||||
if (this.timeoutId !== -1) {
|
||||
clearTimeout(this.timeoutId);
|
||||
}
|
||||
this.dirtyComponentSet.forEach((item) => {
|
||||
const nativePtrValid = !item._weakPtr.invalid();
|
||||
if (item._nativePtrChanged && nativePtrValid) {
|
||||
@ -133,12 +136,18 @@ class ModifierUtils {
|
||||
});
|
||||
this.dirtyComponentSet.clear();
|
||||
this.dirtyFlag = false;
|
||||
this.timeoutId = -1;
|
||||
};
|
||||
if (this.timeoutId !== -1) {
|
||||
clearTimeout(this.timeoutId);
|
||||
}
|
||||
this.timeoutId = setTimeout(frameCallback, 100);
|
||||
getUINativeModule().frameNode.registerFrameCallback(frameCallback);
|
||||
}
|
||||
}
|
||||
ModifierUtils.dirtyComponentSet = new Set();
|
||||
ModifierUtils.dirtyFlag = false;
|
||||
ModifierUtils.timeoutId = -1;
|
||||
class ModifierMap {
|
||||
constructor() {
|
||||
this.map_ = new Map();
|
||||
|
Loading…
Reference in New Issue
Block a user