38 lines
818 B
TypeScript
38 lines
818 B
TypeScript
export interface ShowProupParam {
|
|
refs: any;
|
|
ref_name: string;
|
|
delay: number;
|
|
count: number;
|
|
max_count: number;
|
|
}
|
|
|
|
export class TableAddRowHelper {
|
|
private timer_handler: any = null;
|
|
|
|
showProup(param: ShowProupParam) {
|
|
if (this.timer_handler) {
|
|
clearTimeout(this.timer_handler);
|
|
this.timer_handler = null;
|
|
}
|
|
this.show_proup(param);
|
|
}
|
|
|
|
private show_proup = (param: ShowProupParam) => {
|
|
this.timer_handler = setTimeout(() => {
|
|
param.count += param.delay;
|
|
if (param.count > param.max_count) {
|
|
console.log("errrrrrrrrr");
|
|
return;
|
|
}
|
|
if (param.refs) {
|
|
const dom = param.refs[param.ref_name];
|
|
if (dom) {
|
|
dom.show();
|
|
} else {
|
|
this.show_proup(param);
|
|
}
|
|
}
|
|
}, param.delay);
|
|
};
|
|
}
|