更新了一些不重要的代码规范修正
This commit is contained in:
parent
b817fbd384
commit
4c5ea92f29
|
|
@ -25,7 +25,7 @@ export declare class Cache<ED extends EntityDict & BaseEntityDict> extends Featu
|
||||||
private cacheStore;
|
private cacheStore;
|
||||||
private syncEventsCallbacks;
|
private syncEventsCallbacks;
|
||||||
private contextBuilder;
|
private contextBuilder;
|
||||||
private refreshing;
|
private executing;
|
||||||
private savedEntities;
|
private savedEntities;
|
||||||
private keepFreshPeriod;
|
private keepFreshPeriod;
|
||||||
private localStorage;
|
private localStorage;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export class Cache extends Feature {
|
||||||
cacheStore;
|
cacheStore;
|
||||||
syncEventsCallbacks;
|
syncEventsCallbacks;
|
||||||
contextBuilder;
|
contextBuilder;
|
||||||
refreshing = 0;
|
executing = 0;
|
||||||
savedEntities;
|
savedEntities;
|
||||||
keepFreshPeriod;
|
keepFreshPeriod;
|
||||||
localStorage;
|
localStorage;
|
||||||
|
|
@ -92,13 +92,13 @@ export class Cache extends Feature {
|
||||||
} */
|
} */
|
||||||
async exec(name, params, callback, dontPublish, ignoreContext) {
|
async exec(name, params, callback, dontPublish, ignoreContext) {
|
||||||
try {
|
try {
|
||||||
this.refreshing++;
|
this.executing++;
|
||||||
const { result, opRecords, message } = await this.connector.callAspect(name, params, ignoreContext ? undefined : this.context || this.contextBuilder());
|
const { result, opRecords, message } = await this.connector.callAspect(name, params, ignoreContext ? undefined : this.context || this.contextBuilder());
|
||||||
callback && callback(result, opRecords);
|
callback && callback(result, opRecords);
|
||||||
if (opRecords?.length) {
|
if (opRecords?.length) {
|
||||||
this.syncInner(opRecords);
|
this.syncInner(opRecords);
|
||||||
}
|
}
|
||||||
this.refreshing--;
|
this.executing--;
|
||||||
if (opRecords && opRecords.length > 0 && !dontPublish) {
|
if (opRecords && opRecords.length > 0 && !dontPublish) {
|
||||||
this.publish();
|
this.publish();
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +109,7 @@ export class Cache extends Feature {
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
// 如果是数据不一致错误,这里可以让用户知道
|
// 如果是数据不一致错误,这里可以让用户知道
|
||||||
this.refreshing--;
|
this.executing--;
|
||||||
if (e instanceof OakException) {
|
if (e instanceof OakException) {
|
||||||
const { opRecords } = e;
|
const { opRecords } = e;
|
||||||
if (opRecords.length) {
|
if (opRecords.length) {
|
||||||
|
|
@ -440,7 +440,7 @@ export class Cache extends Feature {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fetchRows(missedRows) {
|
fetchRows(missedRows) {
|
||||||
if (!this.refreshing) {
|
if (!this.executing) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
console.warn('缓存被动去获取数据,请查看页面行为并加以优化', missedRows);
|
console.warn('缓存被动去获取数据,请查看页面行为并加以优化', missedRows);
|
||||||
}
|
}
|
||||||
|
|
@ -462,7 +462,7 @@ export class Cache extends Feature {
|
||||||
const result = this.cacheStore.select(entity, selection, this.context, {
|
const result = this.cacheStore.select(entity, selection, this.context, {
|
||||||
dontCollect: true,
|
dontCollect: true,
|
||||||
includedDeleted: true,
|
includedDeleted: true,
|
||||||
warnWhenAttributeMiss: !this.refreshing && process.env.NODE_ENV === 'development',
|
warnWhenAttributeMiss: !this.executing && process.env.NODE_ENV === 'development',
|
||||||
});
|
});
|
||||||
rollback && rollback();
|
rollback && rollback();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,6 @@ declare class VirtualNode<ED extends EntityDict & BaseEntityDict> extends Node<E
|
||||||
entity: keyof ED;
|
entity: keyof ED;
|
||||||
operation: ED[keyof ED]['Operation'];
|
operation: ED[keyof ED]['Operation'];
|
||||||
}> | undefined;
|
}> | undefined;
|
||||||
setExecuting(executing: boolean): void;
|
|
||||||
clean(lsn?: number, dontPublish?: true): void;
|
clean(lsn?: number, dontPublish?: true): void;
|
||||||
checkIfClean(node: Node<ED>): boolean;
|
checkIfClean(node: Node<ED>): boolean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1845,10 +1845,6 @@ class VirtualNode extends Node {
|
||||||
}
|
}
|
||||||
return operationss;
|
return operationss;
|
||||||
}
|
}
|
||||||
setExecuting(executing) {
|
|
||||||
this.executing = executing;
|
|
||||||
this.publish();
|
|
||||||
}
|
|
||||||
clean(lsn, dontPublish) {
|
clean(lsn, dontPublish) {
|
||||||
for (const ele in this.children) {
|
for (const ele in this.children) {
|
||||||
this.children[ele].clean(lsn, true);
|
this.children[ele].clean(lsn, true);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export declare class Cache<ED extends EntityDict & BaseEntityDict> extends Featu
|
||||||
private cacheStore;
|
private cacheStore;
|
||||||
private syncEventsCallbacks;
|
private syncEventsCallbacks;
|
||||||
private contextBuilder;
|
private contextBuilder;
|
||||||
private refreshing;
|
private executing;
|
||||||
private savedEntities;
|
private savedEntities;
|
||||||
private keepFreshPeriod;
|
private keepFreshPeriod;
|
||||||
private localStorage;
|
private localStorage;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class Cache extends Feature_1.Feature {
|
||||||
cacheStore;
|
cacheStore;
|
||||||
syncEventsCallbacks;
|
syncEventsCallbacks;
|
||||||
contextBuilder;
|
contextBuilder;
|
||||||
refreshing = 0;
|
executing = 0;
|
||||||
savedEntities;
|
savedEntities;
|
||||||
keepFreshPeriod;
|
keepFreshPeriod;
|
||||||
localStorage;
|
localStorage;
|
||||||
|
|
@ -95,13 +95,13 @@ class Cache extends Feature_1.Feature {
|
||||||
} */
|
} */
|
||||||
async exec(name, params, callback, dontPublish, ignoreContext) {
|
async exec(name, params, callback, dontPublish, ignoreContext) {
|
||||||
try {
|
try {
|
||||||
this.refreshing++;
|
this.executing++;
|
||||||
const { result, opRecords, message } = await this.connector.callAspect(name, params, ignoreContext ? undefined : this.context || this.contextBuilder());
|
const { result, opRecords, message } = await this.connector.callAspect(name, params, ignoreContext ? undefined : this.context || this.contextBuilder());
|
||||||
callback && callback(result, opRecords);
|
callback && callback(result, opRecords);
|
||||||
if (opRecords?.length) {
|
if (opRecords?.length) {
|
||||||
this.syncInner(opRecords);
|
this.syncInner(opRecords);
|
||||||
}
|
}
|
||||||
this.refreshing--;
|
this.executing--;
|
||||||
if (opRecords && opRecords.length > 0 && !dontPublish) {
|
if (opRecords && opRecords.length > 0 && !dontPublish) {
|
||||||
this.publish();
|
this.publish();
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ class Cache extends Feature_1.Feature {
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
// 如果是数据不一致错误,这里可以让用户知道
|
// 如果是数据不一致错误,这里可以让用户知道
|
||||||
this.refreshing--;
|
this.executing--;
|
||||||
if (e instanceof Exception_1.OakException) {
|
if (e instanceof Exception_1.OakException) {
|
||||||
const { opRecords } = e;
|
const { opRecords } = e;
|
||||||
if (opRecords.length) {
|
if (opRecords.length) {
|
||||||
|
|
@ -443,7 +443,7 @@ class Cache extends Feature_1.Feature {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fetchRows(missedRows) {
|
fetchRows(missedRows) {
|
||||||
if (!this.refreshing) {
|
if (!this.executing) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
console.warn('缓存被动去获取数据,请查看页面行为并加以优化', missedRows);
|
console.warn('缓存被动去获取数据,请查看页面行为并加以优化', missedRows);
|
||||||
}
|
}
|
||||||
|
|
@ -465,7 +465,7 @@ class Cache extends Feature_1.Feature {
|
||||||
const result = this.cacheStore.select(entity, selection, this.context, {
|
const result = this.cacheStore.select(entity, selection, this.context, {
|
||||||
dontCollect: true,
|
dontCollect: true,
|
||||||
includedDeleted: true,
|
includedDeleted: true,
|
||||||
warnWhenAttributeMiss: !this.refreshing && process.env.NODE_ENV === 'development',
|
warnWhenAttributeMiss: !this.executing && process.env.NODE_ENV === 'development',
|
||||||
});
|
});
|
||||||
rollback && rollback();
|
rollback && rollback();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,6 @@ declare class VirtualNode<ED extends EntityDict & BaseEntityDict> extends Node<E
|
||||||
entity: keyof ED;
|
entity: keyof ED;
|
||||||
operation: ED[keyof ED]['Operation'];
|
operation: ED[keyof ED]['Operation'];
|
||||||
}> | undefined;
|
}> | undefined;
|
||||||
setExecuting(executing: boolean): void;
|
|
||||||
clean(lsn?: number, dontPublish?: true): void;
|
clean(lsn?: number, dontPublish?: true): void;
|
||||||
checkIfClean(node: Node<ED>): boolean;
|
checkIfClean(node: Node<ED>): boolean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1848,10 +1848,6 @@ class VirtualNode extends Node {
|
||||||
}
|
}
|
||||||
return operationss;
|
return operationss;
|
||||||
}
|
}
|
||||||
setExecuting(executing) {
|
|
||||||
this.executing = executing;
|
|
||||||
this.publish();
|
|
||||||
}
|
|
||||||
clean(lsn, dontPublish) {
|
clean(lsn, dontPublish) {
|
||||||
for (const ele in this.children) {
|
for (const ele in this.children) {
|
||||||
this.children[ele].clean(lsn, true);
|
this.children[ele].clean(lsn, true);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export class Cache<ED extends EntityDict & BaseEntityDict> extends Feature {
|
||||||
(opRecords: OpRecord<ED>[]) => void
|
(opRecords: OpRecord<ED>[]) => void
|
||||||
>;
|
>;
|
||||||
private contextBuilder: () => SyncContext<ED>;
|
private contextBuilder: () => SyncContext<ED>;
|
||||||
private refreshing = 0;
|
private executing = 0;
|
||||||
private savedEntities: (keyof ED)[];
|
private savedEntities: (keyof ED)[];
|
||||||
private keepFreshPeriod: number;
|
private keepFreshPeriod: number;
|
||||||
private localStorage: LocalStorage;
|
private localStorage: LocalStorage;
|
||||||
|
|
@ -171,13 +171,13 @@ export class Cache<ED extends EntityDict & BaseEntityDict> extends Feature {
|
||||||
ignoreContext?: true,
|
ignoreContext?: true,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
this.refreshing++;
|
this.executing++;
|
||||||
const { result, opRecords, message } = await this.connector.callAspect(name as string, params, ignoreContext ? undefined : this.context || this.contextBuilder());
|
const { result, opRecords, message } = await this.connector.callAspect(name as string, params, ignoreContext ? undefined : this.context || this.contextBuilder());
|
||||||
callback && callback(result, opRecords);
|
callback && callback(result, opRecords);
|
||||||
if (opRecords?.length) {
|
if (opRecords?.length) {
|
||||||
this.syncInner(opRecords);
|
this.syncInner(opRecords);
|
||||||
}
|
}
|
||||||
this.refreshing--;
|
this.executing--;
|
||||||
if (opRecords && opRecords.length > 0 && !dontPublish) {
|
if (opRecords && opRecords.length > 0 && !dontPublish) {
|
||||||
this.publish();
|
this.publish();
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +188,7 @@ export class Cache<ED extends EntityDict & BaseEntityDict> extends Feature {
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
// 如果是数据不一致错误,这里可以让用户知道
|
// 如果是数据不一致错误,这里可以让用户知道
|
||||||
this.refreshing--;
|
this.executing--;
|
||||||
if (e instanceof OakException) {
|
if (e instanceof OakException) {
|
||||||
const { opRecords } = e;
|
const { opRecords } = e;
|
||||||
if (opRecords.length) {
|
if (opRecords.length) {
|
||||||
|
|
@ -592,7 +592,7 @@ export class Cache<ED extends EntityDict & BaseEntityDict> extends Feature {
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchRows(missedRows: Array<{ entity: keyof ED, selection: ED[keyof ED]['Selection'] }>) {
|
fetchRows(missedRows: Array<{ entity: keyof ED, selection: ED[keyof ED]['Selection'] }>) {
|
||||||
if (!this.refreshing) {
|
if (!this.executing) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
console.warn('缓存被动去获取数据,请查看页面行为并加以优化', missedRows);
|
console.warn('缓存被动去获取数据,请查看页面行为并加以优化', missedRows);
|
||||||
}
|
}
|
||||||
|
|
@ -621,7 +621,7 @@ export class Cache<ED extends EntityDict & BaseEntityDict> extends Feature {
|
||||||
{
|
{
|
||||||
dontCollect: true,
|
dontCollect: true,
|
||||||
includedDeleted: true,
|
includedDeleted: true,
|
||||||
warnWhenAttributeMiss: !this.refreshing && process.env.NODE_ENV === 'development',
|
warnWhenAttributeMiss: !this.executing && process.env.NODE_ENV === 'development',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
rollback && rollback();
|
rollback && rollback();
|
||||||
|
|
|
||||||
|
|
@ -2197,11 +2197,6 @@ class VirtualNode<ED extends EntityDict & BaseEntityDict> extends Node<ED> {
|
||||||
return operationss;
|
return operationss;
|
||||||
}
|
}
|
||||||
|
|
||||||
setExecuting(executing: boolean) {
|
|
||||||
this.executing = executing;
|
|
||||||
this.publish();
|
|
||||||
}
|
|
||||||
|
|
||||||
clean(lsn?: number, dontPublish?: true) {
|
clean(lsn?: number, dontPublish?: true) {
|
||||||
for (const ele in this.children) {
|
for (const ele in this.children) {
|
||||||
this.children[ele].clean(lsn, true);
|
this.children[ele].clean(lsn, true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue